Move legacy field to class

This commit is contained in:
vemacs 2016-01-19 11:01:09 -07:00
parent a1d40f24a7
commit d895d40fbf
1 changed files with 3 additions and 3 deletions

View File

@ -28,6 +28,7 @@ public class UserMap extends CacheLoader<String, User> implements IConf {
private UUIDMap uuidMap;
private final transient Cache<String, User> users;
private static boolean legacy = false;
public UserMap(final IEssentials ess) {
super();
@ -37,7 +38,6 @@ public class UserMap extends CacheLoader<String, User> implements IConf {
//users = CacheBuilder.newBuilder().maximumSize(ess.getSettings().getMaxUserCacheCount()).softValues().removalListener(remListener).build(this);
CacheBuilder<Object, Object> cacheBuilder = CacheBuilder.newBuilder();
int maxCount = ess.getSettings().getMaxUserCacheCount();
boolean legacy = false;
try {
cacheBuilder.maximumSize(maxCount);
} catch (NoSuchMethodError nsme) {
@ -107,9 +107,9 @@ public class UserMap extends CacheLoader<String, User> implements IConf {
public User getUser(final UUID uuid) {
try {
try {
if (!legacy) {
return ((LoadingCache<String, User>) users).get(uuid.toString());
} catch (SecurityException | ClassCastException e) {
} else {
return legacyCacheGet(uuid);
}
} catch (ExecutionException ex) {