mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15:44 +01:00
close cachemanager on context destroy
This commit is contained in:
@@ -55,6 +55,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.ServletContextEvent;
|
||||
import sonia.scm.cache.CacheManager;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -89,6 +90,9 @@ public class ScmContextListener extends GuiceServletContextListener
|
||||
|
||||
// close StoreFactory
|
||||
IOUtil.close(injector.getInstance(StoreFactory.class));
|
||||
|
||||
// close CacheManager
|
||||
IOUtil.close( injector.getInstance( CacheManager.class ) );
|
||||
}
|
||||
|
||||
super.contextDestroyed(servletContextEvent);
|
||||
|
||||
@@ -40,6 +40,10 @@ import com.google.inject.Singleton;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
@@ -67,6 +71,20 @@ public class EhCacheManager implements CacheManager
|
||||
new net.sf.ehcache.CacheManager(EhCacheManager.class.getResource(CONFIG));
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@Override
|
||||
public void close() throws IOException
|
||||
{
|
||||
cacheManager.shutdown();
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user