Fix tile render timmes, split out utility class
This commit is contained in:
parent
9afe25b449
commit
137b6af6d5
4 changed files with 34 additions and 19 deletions
|
|
@ -2,11 +2,11 @@ package org.dynmap;
|
|||
import java.io.File;
|
||||
import java.io.RandomAccessFile;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
import java.io.IOException;
|
||||
import java.util.zip.CRC32;
|
||||
|
||||
import org.dynmap.utils.LRULinkedHashMap;
|
||||
|
||||
/**
|
||||
* Image hash code manager - used to reduce compression and notification of updated tiles that do not actually yield new content
|
||||
*
|
||||
|
|
@ -97,17 +97,6 @@ public class TileHashManager {
|
|||
}
|
||||
}
|
||||
|
||||
public static class LRULinkedHashMap<T, K> extends LinkedHashMap<T, K> {
|
||||
private int limit;
|
||||
public LRULinkedHashMap(int lim) {
|
||||
super(16, (float)0.75, true);
|
||||
limit = lim;
|
||||
}
|
||||
protected boolean removeEldestEntry(Map.Entry<T, K> last) {
|
||||
return(size() >= limit);
|
||||
}
|
||||
}
|
||||
|
||||
private static final int MAX_CACHED_TILEHASHFILES = 25;
|
||||
private Object lock = new Object();
|
||||
private LRULinkedHashMap<TileHashFile, byte[]> tilehash = new LRULinkedHashMap<TileHashFile, byte[]>(MAX_CACHED_TILEHASHFILES);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue