unlock()永远不会被调用但是使用try..finally

时间:2015-11-12 17:17:08

标签: java multithreading servlets

我正在使用servlet(大气框架和自定义框架),它们都使用相同的ReentrantLock来同步某些操作。我得到了令人困惑的行为,一个线程一次又一次地进入锁定而没有调用unlock()匹配其先前的lock()

出于调试目的,我在lock()调用之后添加了堆栈跟踪的转储,它总是显示相同的输出。这是不是意味着,我的方法一次又一次地被调用,但后续的try...finally永远不会被执行?

IManagerLock batchLock = _lockManager.getManagerLock(true);
try {
    // ...do something - in this case the code won't try to lock() again
}
finally {
    batchLock.unlock();
}

getManagerLock()将获取锁并在锁周围返回一些包装器对象,这允许我执行一些调试等。将UUID分配给包装器对象,该对象将打印到lock()unlock()上的日志中。

以下是有线堆栈跟踪的示例。重复七次。如您所见,只有Locked: xxx但不是Unlocked: xxx消息。

17:25:18,550 INFO  [stdout] (http-/0.0.0.0:8080-13) Locked: 1a59d9ea-841f-4024-9043-67c8e649c342
17:25:18,551 ERROR [stderr] (http-/0.0.0.0:8080-13) java.lang.Exception
17:25:18,551 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.DefaultLockManager$LockManagerBatch.<init>(DefaultLockManager.java:377)
17:25:18,552 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.DefaultLockManager.getManagerLock(DefaultLockManager.java:246)
17:25:18,553 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.DefaultLockManager$Proxy$_$$_WeldClientProxy.getManagerLock(DefaultLockManager$Proxy$_$$_WeldClientProxy.java)
17:25:18,553 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.channel.LockChannel.onClose(LockChannel.java:128)
17:25:18,554 ERROR [stderr] (http-/0.0.0.0:8080-13)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:25:18,554 ERROR [stderr] (http-/0.0.0.0:8080-13)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
17:25:18,555 ERROR [stderr] (http-/0.0.0.0:8080-13)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
17:25:18,556 ERROR [stderr] (http-/0.0.0.0:8080-13)     at java.lang.reflect.Method.invoke(Method.java:606)
17:25:18,556 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.util.Utils.invoke(Utils.java:209)
17:25:18,556 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.config.managed.ManagedAtmosphereHandler.invoke(ManagedAtmosphereHandler.java:335)
17:25:18,557 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.config.managed.ManagedAtmosphereHandler.onStateChange(ManagedAtmosphereHandler.java:209)
17:25:18,557 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.invokeAtmosphereHandler(AsynchronousProcessor.java:544)
17:25:18,558 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.completeLifecycle(AsynchronousProcessor.java:486)
17:25:18,558 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.interceptor.OnDisconnectInterceptor.inspect(OnDisconnectInterceptor.java:77)
17:25:18,558 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.invokeInterceptors(AsynchronousProcessor.java:340)
17:25:18,559 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:199)
17:25:18,559 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:115)
17:25:18,560 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.container.JBossWebCometSupport.service(JBossWebCometSupport.java:93)
17:25:18,560 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2281)
17:25:18,560 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AtmosphereServlet.event(AtmosphereServlet.java:326)
17:25:18,560 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilterEvent(ApplicationFilterChain.java:494)
17:25:18,560 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.ApplicationFilterChain.doFilterEvent(ApplicationFilterChain.java:399)
17:25:18,561 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:273)
17:25:18,561 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
17:25:18,561 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
17:25:18,561 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165)
17:25:18,562 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
17:25:18,562 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
17:25:18,562 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
17:25:18,562 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372)
17:25:18,562 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897)
17:25:18,563 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:634)
17:25:18,563 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2039)
17:25:18,563 ERROR [stderr] (http-/0.0.0.0:8080-13)     at java.lang.Thread.run(Thread.java:745)
17:25:18,567 INFO  [stdout] (http-/0.0.0.0:8080-13) Locked: 56fe9bc2-6c52-4fe4-8011-858221db4318
17:25:18,568 ERROR [stderr] (http-/0.0.0.0:8080-13) java.lang.Exception
17:25:18,568 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.DefaultLockManager$LockManagerBatch.<init>(DefaultLockManager.java:377)
17:25:18,568 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.DefaultLockManager.getManagerLock(DefaultLockManager.java:246)
17:25:18,568 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.DefaultLockManager$Proxy$_$$_WeldClientProxy.getManagerLock(DefaultLockManager$Proxy$_$$_WeldClientProxy.java)
17:25:18,568 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.channel.LockChannel.onClose(LockChannel.java:128)
17:25:18,569 ERROR [stderr] (http-/0.0.0.0:8080-13)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:25:18,569 ERROR [stderr] (http-/0.0.0.0:8080-13)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
17:25:18,569 ERROR [stderr] (http-/0.0.0.0:8080-13)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
17:25:18,569 ERROR [stderr] (http-/0.0.0.0:8080-13)     at java.lang.reflect.Method.invoke(Method.java:606)
17:25:18,569 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.util.Utils.invoke(Utils.java:209)
17:25:18,569 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.config.managed.ManagedAtmosphereHandler.invoke(ManagedAtmosphereHandler.java:335)
17:25:18,569 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.config.managed.ManagedAtmosphereHandler.onStateChange(ManagedAtmosphereHandler.java:209)
17:25:18,570 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.invokeAtmosphereHandler(AsynchronousProcessor.java:544)
17:25:18,570 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.completeLifecycle(AsynchronousProcessor.java:486)
17:25:18,570 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.interceptor.OnDisconnectInterceptor.inspect(OnDisconnectInterceptor.java:77)
17:25:18,572 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.invokeInterceptors(AsynchronousProcessor.java:340)
17:25:18,572 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:199)
17:25:18,572 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:115)
17:25:18,572 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.container.JBossWebCometSupport.service(JBossWebCometSupport.java:93)
17:25:18,575 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2281)
17:25:18,575 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AtmosphereServlet.event(AtmosphereServlet.java:326)
17:25:18,575 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilterEvent(ApplicationFilterChain.java:494)
17:25:18,575 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.ApplicationFilterChain.doFilterEvent(ApplicationFilterChain.java:399)
17:25:18,576 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:273)
17:25:18,576 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
17:25:18,576 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
17:25:18,576 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165)
17:25:18,577 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
17:25:18,577 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
17:25:18,577 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
17:25:18,577 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372)
17:25:18,579 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897)
17:25:18,579 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:634)
17:25:18,579 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2039)
17:25:18,579 ERROR [stderr] (http-/0.0.0.0:8080-13)     at java.lang.Thread.run(Thread.java:745)
17:25:18,584 INFO  [stdout] (http-/0.0.0.0:8080-13) Locked: 0f2d436a-7e80-4a56-97e2-42187ac56a8b
17:25:18,584 ERROR [stderr] (http-/0.0.0.0:8080-13) java.lang.Exception
17:25:18,584 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.DefaultLockManager$LockManagerBatch.<init>(DefaultLockManager.java:377)
17:25:18,585 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.DefaultLockManager.getManagerLock(DefaultLockManager.java:246)
17:25:18,585 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.DefaultLockManager$Proxy$_$$_WeldClientProxy.getManagerLock(DefaultLockManager$Proxy$_$$_WeldClientProxy.java)
17:25:18,585 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.channel.LockChannel.onClose(LockChannel.java:128)
17:25:18,586 ERROR [stderr] (http-/0.0.0.0:8080-13)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:25:18,586 ERROR [stderr] (http-/0.0.0.0:8080-13)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
17:25:18,586 ERROR [stderr] (http-/0.0.0.0:8080-13)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
17:25:18,586 ERROR [stderr] (http-/0.0.0.0:8080-13)     at java.lang.reflect.Method.invoke(Method.java:606)
17:25:18,586 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.util.Utils.invoke(Utils.java:209)
17:25:18,586 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.config.managed.ManagedAtmosphereHandler.invoke(ManagedAtmosphereHandler.java:335)
17:25:18,589 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.config.managed.ManagedAtmosphereHandler.onStateChange(ManagedAtmosphereHandler.java:209)
17:25:18,589 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.invokeAtmosphereHandler(AsynchronousProcessor.java:544)
17:25:18,589 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.completeLifecycle(AsynchronousProcessor.java:486)
17:25:18,589 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.interceptor.OnDisconnectInterceptor.inspect(OnDisconnectInterceptor.java:77)
17:25:18,591 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.invokeInterceptors(AsynchronousProcessor.java:340)
17:25:18,591 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.action(AsynchronousProcessor.java:199)
17:25:18,591 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AsynchronousProcessor.suspended(AsynchronousProcessor.java:115)
17:25:18,591 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.container.JBossWebCometSupport.service(JBossWebCometSupport.java:93)
17:25:18,593 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AtmosphereFramework.doCometSupport(AtmosphereFramework.java:2281)
17:25:18,593 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.atmosphere.cpr.AtmosphereServlet.event(AtmosphereServlet.java:326)
17:25:18,593 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilterEvent(ApplicationFilterChain.java:494)
17:25:18,593 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.ApplicationFilterChain.doFilterEvent(ApplicationFilterChain.java:399)
17:25:18,595 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:273)
17:25:18,595 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
17:25:18,595 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
17:25:18,595 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165)
17:25:18,596 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
17:25:18,597 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
17:25:18,597 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
17:25:18,597 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372)
17:25:18,598 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897)
17:25:18,598 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:634)
17:25:18,599 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2039)
17:25:18,599 ERROR [stderr] (http-/0.0.0.0:8080-13)     at java.lang.Thread.run(Thread.java:745)

几秒钟后,同一个线程处理了更多的HTTP请求,并且所有请求都成功返回,这次使用了正确的Locked: xxxUnlocked: xxx消息:

17:25:23,891 INFO  [stdout] (http-/0.0.0.0:8080-13) Locked: 351e7416-c74b-4974-b2a6-a2ba0a0ad87d
17:25:23,892 ERROR [stderr] (http-/0.0.0.0:8080-13) java.lang.Exception
17:25:23,893 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.DefaultLockManager$LockManagerBatch.<init>(DefaultLockManager.java:377)
17:25:23,894 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.DefaultLockManager.getManagerLock(DefaultLockManager.java:246)
17:25:23,896 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.DefaultLockManager$Proxy$_$$_WeldClientProxy.getManagerLock(DefaultLockManager$Proxy$_$$_WeldClientProxy.java)
17:25:23,897 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.command.LockCommand.invoke(LockCommand.java:33)
17:25:23,898 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.PageLockCommandServlet._executeCommand(PageLockCommandServlet.java:90)
17:25:23,899 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.jee.pagelock.PageLockCommandServlet.doPost(PageLockCommandServlet.java:61)
17:25:23,900 ERROR [stderr] (http-/0.0.0.0:8080-13)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
17:25:23,900 ERROR [stderr] (http-/0.0.0.0:8080-13)     at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
17:25:23,901 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
17:25:23,901 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
17:25:23,901 ERROR [stderr] (http-/0.0.0.0:8080-13)     at xxx.webapp.servlet.filter.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:51)
17:25:23,902 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
17:25:23,902 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
17:25:23,903 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)
17:25:23,903 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
17:25:23,903 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
17:25:23,904 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
17:25:23,904 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
17:25:23,904 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
17:25:23,905 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:165)
17:25:23,905 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
17:25:23,905 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
17:25:23,906 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
17:25:23,906 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:372)
17:25:23,906 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:897)
17:25:23,907 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:634)
17:25:23,907 ERROR [stderr] (http-/0.0.0.0:8080-13)     at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:2039)
17:25:23,907 ERROR [stderr] (http-/0.0.0.0:8080-13)     at java.lang.Thread.run(Thread.java:745)
17:25:23,908 INFO  [stdout] (http-/0.0.0.0:8080-13) Unlocked: 351e7416-c74b-4974-b2a6-a2ba0a0ad87d

知道发生了什么事吗?你能解释一下如何在不完全执行函数体的情况下一次又一次地执行同一个线程吗?没有释放锁?

编辑12.11.2015 19:56:正如评论中所述:http-/0.0.0.0:8080-13是主题的名称。所以我确定它是再次执行的相同线程。

编辑13.11.2015 09:38:正如评论中所述:我正在使用JBoss 7.1.3.Final和JBossWeb 7.0.17.Final。 AtmosphereServlet使用asyncSupported=true而自定义服务不使用。{/ p>

1 个答案:

答案 0 :(得分:1)

我找到了这种行为的解决方案:涉及一个(CDI)bean,由于某种原因无法创建。在我的日志消息之后和try-block之前抛出异常。但随着大气框架的发现,它在日志中不可见。如果框架设置为debug级别(未在生产服务器上设置),框架本身将仅将其打印到日志中。

一个非常愚蠢的自我造成的错误!