Shift most of touch processing off server main thread

This commit is contained in:
Mike Primm 2012-01-10 12:34:08 +08:00 committed by mikeprimm
parent b62125f70d
commit 0169de4d7b
4 changed files with 232 additions and 152 deletions

View file

@ -8,7 +8,6 @@ import java.util.LinkedHashMap;
import java.util.Map;
import org.bukkit.ChunkSnapshot;
import org.dynmap.DynmapLocation;
public class SnapshotCache {
private CacheHashMap snapcache;
@ -49,24 +48,9 @@ public class SnapshotCache {
snapcache = new CacheHashMap(max_size);
refqueue = new ReferenceQueue<ChunkSnapshot>();
}
private String getKey(DynmapLocation loc) {
return loc.world + ":" + (loc.x>>4) + ":" + (loc.z>>4);
}
private String getKey(String w, int cx, int cz) {
return w + ":" + cx + ":" + cz;
}
/**
* Invalidate cached snapshot, if in cache
*/
public void invalidateSnapshot(DynmapLocation loc) {
String key = getKey(loc);
CacheRec rec = snapcache.remove(key);
if(rec != null) {
snapcache.reverselookup.remove(rec.ref);
rec.ref.clear();
}
processRefQueue();
}
/**
* Invalidate cached snapshot, if in cache
*/