diff --git a/core/src/main/groovy/com/muwire/core/connection/I2PConnector.groovy b/core/src/main/groovy/com/muwire/core/connection/I2PConnector.groovy index afb874d6..2532bbe0 100644 --- a/core/src/main/groovy/com/muwire/core/connection/I2PConnector.groovy +++ b/core/src/main/groovy/com/muwire/core/connection/I2PConnector.groovy @@ -62,10 +62,8 @@ class I2PConnector { } } - synchronized void shutdown() { - if (socketManager == null) - return - socketManager.destroySocketManager() + void shutdown() { + socketManager?.destroySocketManager() socketManager = null } diff --git a/core/src/main/groovy/com/muwire/core/hostcache/H2HostCache.groovy b/core/src/main/groovy/com/muwire/core/hostcache/H2HostCache.groovy index 2915beb2..4a3166f6 100644 --- a/core/src/main/groovy/com/muwire/core/hostcache/H2HostCache.groovy +++ b/core/src/main/groovy/com/muwire/core/hostcache/H2HostCache.groovy @@ -300,8 +300,8 @@ class H2HostCache extends HostCache { } @Override public synchronized void stop() { - timer.cancel() - sql.close() + try {timer.cancel()} catch (Exception ignore) {} + sql?.close() } @Override public synchronized void load() {