二级缓存(ehcache)在weblogic导致线程增长问题
最近项目中用到hibernate搭配ehcache做二级缓存。部署到weblogic,如果weblogic不挺下来。直接在weblogic console 中stop-->update-->start 做重新部署操作。用jconsole观察到Thread数量会随部署次数稳定增长。研究了下ehcache。ehcache如果缓存到硬盘。对应每个table,ehcache都会起一对线程来维护这些table cache。一对如下线程:
private final class SpoolAndExpiryThread extends Thread {
public SpoolAndExpiryThread() {
super("Store " + name + " Spool Thread");
setDaemon(true);
setPriority(Thread.NORM_PRIORITY);
spoolAndExpiryThreadActive = true;
}
/**
* RemoteDebugger thread method.
*/
@Override
public final void run() {
spoolAndExpiryThreadMain();
}
}
这些线程都设置为后台线程 setDeamon(true);
这些后台线程只有在把weblogic关了之后才会停下来,所以weblogic不重启,直接update war 然后start。ehcache会重新 new 很多新的线程。
这个问题不知道有什么解法
页:
[1]