mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-06-17 06:11:06 +00:00
fix lastUse
This commit is contained in:
@@ -22,7 +22,7 @@ import java.util.function.Supplier;
|
|||||||
public class IrisEngineSVC implements IrisService {
|
public class IrisEngineSVC implements IrisService {
|
||||||
private static final AtomicInteger tectonicLimit = new AtomicInteger(30);
|
private static final AtomicInteger tectonicLimit = new AtomicInteger(30);
|
||||||
private final ReentrantLock lastUseLock = new ReentrantLock();
|
private final ReentrantLock lastUseLock = new ReentrantLock();
|
||||||
private final KMap<Engine, Long> lastUse = new KMap<>();
|
private final KMap<World, Long> lastUse = new KMap<>();
|
||||||
private Looper cacheTicker;
|
private Looper cacheTicker;
|
||||||
private Looper trimTicker;
|
private Looper trimTicker;
|
||||||
private Looper unloadTicker;
|
private Looper unloadTicker;
|
||||||
@@ -53,7 +53,7 @@ public class IrisEngineSVC implements IrisService {
|
|||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
lastUseLock.lock();
|
lastUseLock.lock();
|
||||||
try {
|
try {
|
||||||
for (Engine key : new ArrayList<>(lastUse.keySet())) {
|
for (World key : new ArrayList<>(lastUse.keySet())) {
|
||||||
Long last = lastUse.get(key);
|
Long last = lastUse.get(key);
|
||||||
if (last == null)
|
if (last == null)
|
||||||
continue;
|
continue;
|
||||||
@@ -128,7 +128,8 @@ public class IrisEngineSVC implements IrisService {
|
|||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
for (int j = 0; j < worlds.size(); j++) {
|
for (int j = 0; j < worlds.size(); j++) {
|
||||||
PlatformChunkGenerator generator = IrisToolbelt.access(worlds.get(i.getAndIncrement()));
|
World world = worlds.get(i.getAndIncrement());
|
||||||
|
PlatformChunkGenerator generator = IrisToolbelt.access(world);
|
||||||
if (i.get() >= worlds.size()) {
|
if (i.get() >= worlds.size()) {
|
||||||
i.set(0);
|
i.set(0);
|
||||||
}
|
}
|
||||||
@@ -137,7 +138,7 @@ public class IrisEngineSVC implements IrisService {
|
|||||||
Engine engine = generator.getEngine();
|
Engine engine = generator.getEngine();
|
||||||
if (engine != null) {
|
if (engine != null) {
|
||||||
lastUseLock.lock();
|
lastUseLock.lock();
|
||||||
lastUse.put(engine, System.currentTimeMillis());
|
lastUse.put(world, System.currentTimeMillis());
|
||||||
lastUseLock.unlock();
|
lastUseLock.unlock();
|
||||||
return engine;
|
return engine;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user