mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-11-18 16:25:11 +01:00
Wait executor to complete the submitted task before shutting down
* Fix #403
This commit is contained in:
parent
fe31b5cabb
commit
6d7d856ebe
@ -1,11 +1,5 @@
|
||||
package fr.xephi.authme.datasource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.cache.CacheBuilder;
|
||||
import com.google.common.cache.CacheLoader;
|
||||
@ -13,10 +7,16 @@ import com.google.common.cache.LoadingCache;
|
||||
import com.google.common.cache.RemovalListener;
|
||||
import com.google.common.cache.RemovalListeners;
|
||||
import com.google.common.cache.RemovalNotification;
|
||||
|
||||
import fr.xephi.authme.ConsoleLogger;
|
||||
import fr.xephi.authme.cache.auth.PlayerAuth;
|
||||
import fr.xephi.authme.cache.auth.PlayerCache;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class CacheDataSource implements DataSource {
|
||||
@ -233,7 +233,12 @@ public class CacheDataSource implements DataSource {
|
||||
*/
|
||||
@Override
|
||||
public synchronized void close() {
|
||||
try {
|
||||
exec.shutdown();
|
||||
exec.awaitTermination(8, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException e) {
|
||||
ConsoleLogger.writeStackTrace(e);
|
||||
}
|
||||
source.close();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user