INFO: A valid shutdown command was received via the shutdown port. Stopping the Server instance. Apr 02, 2015 10:36:52 AM org.apache.coyote.AbstractProtocol pause INFO: Pausing ProtocolHandler ["http-bio-8080"] Apr 02, 2015 10:36:52 AM org.apache.coyote.AbstractProtocol pause INFO: Pausing ProtocolHandler ["ajp-bio-8009"] Apr 02, 2015 10:36:52 AM org.apache.catalina.core.StandardService stopInternal INFO: Stopping service Catalina Apr 02, 2015 10:36:52 AM org.apache.catalina.core.ApplicationContext log INFO: Closing Spring root WebApplicationContext Apr 02, 2015 10:36:52 AM org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks <span style="color:#ff0000;">SEVERE: The web application [/techrevmanager5] created a ThreadLocal with key of type [com.opensymphony.xwork2.inject.ContainerImpl$3] (value [com.opensymphony.xwork2.inject.ContainerImpl$3@49860b6d]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@7f5846d0]) but failed to remove it when the web application was stopped. Threads are going to be renewed over time to try and avoid a probable memory leak.</span> Apr 02, 2015 10:36:52 AM org.apache.coyote.AbstractProtocol stop INFO: Stopping ProtocolHandler ["http-bio-8080"] Apr 02, 2015 10:36:52 AM org.apache.coyote.AbstractProtocol stop INFO: Stopping ProtocolHandler ["ajp-bio-8009"] Apr 02, 2015 10:36:52 AM org.apache.coyote.AbstractProtocol destroy INFO: Destroying ProtocolHandler ["http-bio-8080"] Apr 02, 2015 10:36:52 AM org.apache.coyote.AbstractProtocol destroy INFO: Destroying ProtocolHandler ["ajp-bio-8009"]
//这里在线程变量中初始化了一维数组 ThreadLocal<Object[]> localContext = new ThreadLocal<Object[]>() { @Override protected Object[] initialValue() { return new Object[1]; } }; /** * Looks up thread local context. Creates (and removes) a new context if * necessary. */ <T> T callInContext(ContextualCallable<T> callable) { Object[] reference = localContext.get(); if (reference[0] == null) { reference[0] = new InternalContext(this); try { return callable.call((InternalContext)reference[0]); } finally { // Only remove the context if this call created it. reference[0] = null; //这里只将数组中的元素释放,并未将线程变量的数组对象释放 } } else { // Someone else will clean up this context. return callable.call((InternalContext)reference[0]); } }
<T> T callInContext(ContextualCallable<T> callable) { Object[] reference = localContext.get(); if (reference[0] == null) { reference[0] = new InternalContext(this); try { return callable.call((InternalContext)reference[0]); } finally { // Only remove the context if this call created it. reference[0] = null; //将线程变量的数组对象释放 this.localContext.remove(); } } else { // Someone else will clean up this context. return callable.call((InternalContext)reference[0]); } }
在tomcat7下停止应用时报错:created a ThreadLocal with key of type
原文地址:http://blog.csdn.net/robinsone/article/details/44829529