mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-17 14:21:33 +00:00
e
This commit is contained in:
@@ -412,7 +412,7 @@ public class Mantle {
|
|||||||
double adjustedIdleDuration = baseIdleDuration;
|
double adjustedIdleDuration = baseIdleDuration;
|
||||||
|
|
||||||
if (loadedRegions.size() > tectonicLimit) {
|
if (loadedRegions.size() > tectonicLimit) {
|
||||||
adjustedIdleDuration = Math.max(adjustedIdleDuration - ( 1000 * (loadedRegions.size() - tectonicLimit) * 1.35), 4000);
|
adjustedIdleDuration = Math.max(adjustedIdleDuration - (1000 * (loadedRegions.size() - tectonicLimit) * 1.35), 4000);
|
||||||
}
|
}
|
||||||
|
|
||||||
io.set(true);
|
io.set(true);
|
||||||
@@ -432,11 +432,10 @@ public class Mantle {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a thread pool to handle unloading tasks
|
BurstExecutor burstExecutor = new BurstExecutor(Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors()), toUnload.size());
|
||||||
ExecutorService executor = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
|
||||||
|
|
||||||
for (Long i : toUnload) {
|
for (Long i : toUnload) {
|
||||||
executor.submit(() -> {
|
burstExecutor.queue(() -> {
|
||||||
hyperLock.withLong(i, () -> {
|
hyperLock.withLong(i, () -> {
|
||||||
TectonicPlate m = loadedRegions.get(i);
|
TectonicPlate m = loadedRegions.get(i);
|
||||||
if (m != null) {
|
if (m != null) {
|
||||||
@@ -454,16 +453,13 @@ public class Mantle {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shutdown the executor and wait for tasks to complete
|
burstExecutor.complete();
|
||||||
executor.shutdown();
|
|
||||||
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
Thread.currentThread().interrupt();
|
|
||||||
e.printStackTrace();
|
|
||||||
} finally {
|
} finally {
|
||||||
io.set(false);
|
io.set(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public long ToUnloadTectonic(){
|
public long ToUnloadTectonic(){
|
||||||
return FakeToUnload.get();
|
return FakeToUnload.get();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user