From c9b884624d9d61a21e7a986e29a4cab7bdf529c0 Mon Sep 17 00:00:00 2001 From: DNx5 Date: Fri, 5 Feb 2016 23:26:46 +0700 Subject: [PATCH] - Make cache RemovalListener sync (no longer use executor). - Fix #433 --- .../java/fr/xephi/authme/datasource/CacheDataSource.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java index bec25c85b..d27dbc922 100644 --- a/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java +++ b/src/main/java/fr/xephi/authme/datasource/CacheDataSource.java @@ -34,9 +34,9 @@ public class CacheDataSource implements DataSource { public CacheDataSource(DataSource src) { this.source = src; this.exec = Executors.newCachedThreadPool(); - cachedAuths = CacheBuilder.newBuilder() - .expireAfterWrite(5, TimeUnit.MINUTES) - .removalListener(RemovalListeners.asynchronous(new RemovalListener>() { + this.cachedAuths = CacheBuilder.newBuilder() + .expireAfterWrite(8, TimeUnit.MINUTES) + .removalListener(new RemovalListener>() { @Override public void onRemoval(RemovalNotification> removalNotification) { String name = removalNotification.getKey(); @@ -44,7 +44,7 @@ public class CacheDataSource implements DataSource { cachedAuths.getUnchecked(name); } } - }, exec)) + }) .build( new CacheLoader>() { public Optional load(String key) {