2012-04-11 86 views
0

由於一段時間以來我們在Glassfish 3.1上運行的Web應用程序出現嚴重問題。應用程序通過jms進行異步通信。我們的本地服務通過JBossNetty進行通信。由於線程被阻塞導致的性能問題

問題是,我們的Web應用程序的每個請求都會打開一個新線程。沒關係,但線程永遠不會關閉。幾個小時後,由於被阻塞的線程,系統掛起。

一些提示爲什麼線程被阻塞?我附上了下面的線程轉儲。

Full Java Thread Dump Java HotSpot(TM) 64-Bit Server VM 21.0-b17 Oracle Corporation 

Number of threads: 878 

Number of daemon threads: 765 

Peak live thread count since the Java virtual machine started or peak was reset: 932 

Is support for thread contention monitoring available on this JVM? [true] 

Is thread contention monitoring enabled? [false]. If false, some thread synchronization statistics are not be available. 

Is support for CPU time measurement for any thread available on this JVM? [true] 

Is thread CPU time measurement enabled? [true]. If false, thread execution times are not available for any thread. 

-------------------------------------------------------------------------------- 

Thread Execution Information: 

----------------------- 

Thread "pool-34-thread-851" thread-id: 47.019 thread-state: TIMED_WAITING Waiting on lock: [email protected] 

    at: sun.misc.Unsafe.park(Native Method) 

    at: java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226) 

    at: java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460) 

    at: java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:359) 

    at: java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:942) 

    at: java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1043) 

    at: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1103) 

    at: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 

    at: java.lang.Thread.run(Thread.java:722) 

Thread Synchronization Statistics: 

----------------------- 

Number of times this thread was blocked (to enter/reenter a Monitor): 0 

Number of times this thread waited for a notification (i.e. it was in WAITING or TIMED_WAITING state): 2 

Total CPU time for this thread: 0 seconds 0 nanoseconds. 

User-level CPU time for this thread: 0 seconds 0 nanoseconds. 

Object Monitors currently held or requested by this thread: [] 

Ownable Synchronizers (e.g. ReentrantLock and ReentrantReadWriteLock) held by this thread: [] 

-------------------------------------------------------------------------------- 

Thread Execution Information: 

----------------------- 

Thread "pool-34-thread-850" thread-id: 47.018 thread-state: TIMED_WAITING Waiting on lock: [email protected] 

    at: sun.misc.Unsafe.park(Native Method) 

    at: java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226) 

    at: java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460) 

    at: java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:359) 

    at: java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:942) 

    at: java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1043) 

    at: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1103) 

    at: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 

    at: java.lang.Thread.run(Thread.java:722) 

Thread Synchronization Statistics: 

----------------------- 

Number of times this thread was blocked (to enter/reenter a Monitor): 0 

Number of times this thread waited for a notification (i.e. it was in WAITING or TIMED_WAITING state): 1 

Total CPU time for this thread: 0 seconds 0 nanoseconds. 

User-level CPU time for this thread: 0 seconds 0 nanoseconds. 

Object Monitors currently held or requested by this thread: [] 

Ownable Synchronizers (e.g. ReentrantLock and ReentrantReadWriteLock) held by this thread: [] 

-------------------------------------------------------------------------------- 

Thread Execution Information: 

----------------------- 

Thread "hz._hzInstance_1_dev.cached.thread-618" thread-id: 47.014 thread-state: TIMED_WAITING Waiting on lock: [email protected] 

    at: sun.misc.Unsafe.park(Native Method) 

    at: java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226) 

    at: java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460) 

    at: java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:359) 

    at: java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:942) 

    at: java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1043) 

    at: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1103) 

    at: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 

    at: java.lang.Thread.run(Thread.java:722) 

Thread Synchronization Statistics: 

----------------------- 

Number of times this thread was blocked (to enter/reenter a Monitor): 0 

Number of times this thread waited for a notification (i.e. it was in WAITING or TIMED_WAITING state): 3 

Total CPU time for this thread: 0 seconds 0 nanoseconds. 

User-level CPU time for this thread: 0 seconds 0 nanoseconds. 

Object Monitors currently held or requested by this thread: [] 

Ownable Synchronizers (e.g. ReentrantLock and ReentrantReadWriteLock) held by this thread: [] 

-------------------------------------------------------------------------------- 

Thread Execution Information: 

----------------------- 

Thread "New I/O server worker #1-13" thread-id: 47.004 thread-state: BLOCKED Waiting on lock: [email protected] 

    at: com.mycompany.library.transmission.jbossNetty.JBossNettyServer.removeClient(JBossNettyServer.java:412) 

    at: com.mycompany.library.transmission.jbossNetty.ServerChannelHandler.doDisconnect(ServerChannelHandler.java:459) 

    at: com.mycompany.library.transmission.jbossNetty.ServerChannelHandler.channelDisconnected(ServerChannelHandler.java:196) 

    at: org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:132) 

    at: org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545) 

    at: org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754) 

    at: org.jboss.netty.handler.codec.replay.ReplayingDecoder.cleanup(ReplayingDecoder.java:555) 

    at: org.jboss.netty.handler.codec.replay.ReplayingDecoder.channelDisconnected(ReplayingDecoder.java:450) 

    at: org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:112) 

    at: org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545) 

    at: org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540) 

    at: org.jboss.netty.channel.Channels.fireChannelDisconnected(Channels.java:360) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.close(NioWorker.java:587) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:356) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:281) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:201) 

    at: org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) 

    at: org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46) 

    at: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 

    at: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 

    at: java.lang.Thread.run(Thread.java:722) 

Thread Synchronization Statistics: 

----------------------- 

This thread is blocked waiting on lock owned currently by thread named: pool-66-thread-1, id: 41.339 

Number of times this thread was blocked (to enter/reenter a Monitor): 5 

Number of times this thread waited for a notification (i.e. it was in WAITING or TIMED_WAITING state): 3 

Total CPU time for this thread: 0 seconds 31.200.200 nanoseconds. 

User-level CPU time for this thread: 0 seconds 31.200.200 nanoseconds. 

Object Monitors currently held or requested by this thread: [] 

Ownable Synchronizers (e.g. ReentrantLock and ReentrantReadWriteLock) held by this thread: [] 

-------------------------------------------------------------------------------- 

Thread Execution Information: 

----------------------- 

Thread "New I/O server worker #1-15" thread-id: 46.997 thread-state: BLOCKED Waiting on lock: [email protected] 

    at: com.mycompany.library.transmission.jbossNetty.JBossNettyServer.removeClient(JBossNettyServer.java:412) 

    at: com.mycompany.library.transmission.jbossNetty.ServerChannelHandler.doDisconnect(ServerChannelHandler.java:459) 

    at: com.mycompany.library.transmission.jbossNetty.ServerChannelHandler.channelDisconnected(ServerChannelHandler.java:196) 

    at: org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:132) 

    at: org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545) 

    at: org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754) 

    at: org.jboss.netty.handler.codec.replay.ReplayingDecoder.cleanup(ReplayingDecoder.java:555) 

    at: org.jboss.netty.handler.codec.replay.ReplayingDecoder.channelDisconnected(ReplayingDecoder.java:450) 

    at: org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:112) 

    at: org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545) 

    at: org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540) 

    at: org.jboss.netty.channel.Channels.fireChannelDisconnected(Channels.java:360) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.close(NioWorker.java:587) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:356) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:281) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:201) 

    at: org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) 

    at: org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46) 

    at: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 

    at: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 

    at: java.lang.Thread.run(Thread.java:722) 

Thread Synchronization Statistics: 

----------------------- 

This thread is blocked waiting on lock owned currently by thread named: pool-66-thread-1, id: 41.339 

Number of times this thread was blocked (to enter/reenter a Monitor): 9 

Number of times this thread waited for a notification (i.e. it was in WAITING or TIMED_WAITING state): 2 

Total CPU time for this thread: 0 seconds 124.800.800 nanoseconds. 

User-level CPU time for this thread: 0 seconds 124.800.800 nanoseconds. 

Object Monitors currently held or requested by this thread: [] 

Ownable Synchronizers (e.g. ReentrantLock and ReentrantReadWriteLock) held by this thread: [] 

-------------------------------------------------------------------------------- 

Thread Execution Information: 

----------------------- 

Thread "New I/O server worker #1-22" thread-id: 46.985 thread-state: BLOCKED Waiting on lock: [email protected] 

    at: com.mycompany.library.transmission.jbossNetty.JBossNettyServer.addClient(JBossNettyServer.java:395) 

    at: com.mycompany.library.transmission.jbossNetty.ServerChannelHandler.doIdentify(ServerChannelHandler.java:397) 

    at: com.mycompany.library.transmission.jbossNetty.ServerChannelHandler.messageReceived(ServerChannelHandler.java:283) 

    at: org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:100) 

    at: org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545) 

    at: org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754) 

    at: org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:302) 

    at: org.jboss.netty.handler.codec.replay.ReplayingDecoder.unfoldAndfireMessageReceived(ReplayingDecoder.java:526) 

    at: org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:507) 

    at: org.jboss.netty.handler.codec.replay.ReplayingDecoder.messageReceived(ReplayingDecoder.java:444) 

    at: org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:80) 

    at: org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545) 

    at: org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540) 

    at: org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:274) 

    at: org.jboss.netty.channel.Channels.fireMessageReceived(Channels.java:261) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:350) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:281) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:201) 

    at: org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) 

    at: org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46) 

    at: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 

    at: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 

    at: java.lang.Thread.run(Thread.java:722) 

Thread Synchronization Statistics: 

----------------------- 

This thread is blocked waiting on lock owned currently by thread named: pool-66-thread-1, id: 41.339 

Number of times this thread was blocked (to enter/reenter a Monitor): 304 

Number of times this thread waited for a notification (i.e. it was in WAITING or TIMED_WAITING state): 4 

Total CPU time for this thread: 0 seconds 156.001.000 nanoseconds. 

User-level CPU time for this thread: 0 seconds 156.001.000 nanoseconds. 

Object Monitors currently held or requested by this thread: [] 

Ownable Synchronizers (e.g. ReentrantLock and ReentrantReadWriteLock) held by this thread: [] 

-------------------------------------------------------------------------------- 

Thread Execution Information: 

----------------------- 

Thread "New I/O server worker #1-9" thread-id: 46.938 thread-state: RUNNABLE Running in native 

    at: sun.nio.ch.WindowsSelectorImpl$SubSelector.poll0(Native Method) 

    at: sun.nio.ch.WindowsSelectorImpl$SubSelector.poll(WindowsSelectorImpl.java:295) 

    at: sun.nio.ch.WindowsSelectorImpl$SubSelector.access$400(WindowsSelectorImpl.java:277) 

    at: sun.nio.ch.WindowsSelectorImpl.doSelect(WindowsSelectorImpl.java:158) 

    at: sun.nio.ch.SelectorImpl.lockAndDoSelect(SelectorImpl.java:87) 

    at: sun.nio.ch.SelectorImpl.select(SelectorImpl.java:98) 

    at: org.jboss.netty.channel.socket.nio.SelectorUtil.select(SelectorUtil.java:38) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:164) 

    at: org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) 

    at: org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46) 

    at: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 

    at: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 

    at: java.lang.Thread.run(Thread.java:722) 

Thread Synchronization Statistics: 

----------------------- 

Number of times this thread was blocked (to enter/reenter a Monitor): 308 

Number of times this thread waited for a notification (i.e. it was in WAITING or TIMED_WAITING state): 3 

Total CPU time for this thread: 0 seconds 202.801.300 nanoseconds. 

User-level CPU time for this thread: 0 seconds 202.801.300 nanoseconds. 

Object Monitors currently held or requested by this thread: [] 

Ownable Synchronizers (e.g. ReentrantLock and ReentrantReadWriteLock) held by this thread: [] 

-------------------------------------------------------------------------------- 

Thread Execution Information: 

----------------------- 

Thread "New I/O server worker #1-12" thread-id: 46.937 thread-state: BLOCKED Waiting on lock: [email protected] 

    at: com.mycompany.library.transmission.jbossNetty.JBossNettyServer.removeClient(JBossNettyServer.java:412) 

    at: com.mycompany.library.transmission.jbossNetty.ServerChannelHandler.doDisconnect(ServerChannelHandler.java:459) 

    at: com.mycompany.library.transmission.jbossNetty.ServerChannelHandler.channelDisconnected(ServerChannelHandler.java:196) 

    at: org.jboss.netty.channel.SimpleChannelHandler.handleUpstream(SimpleChannelHandler.java:132) 

    at: org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545) 

    at: org.jboss.netty.channel.DefaultChannelPipeline$DefaultChannelHandlerContext.sendUpstream(DefaultChannelPipeline.java:754) 

    at: org.jboss.netty.handler.codec.replay.ReplayingDecoder.cleanup(ReplayingDecoder.java:555) 

    at: org.jboss.netty.handler.codec.replay.ReplayingDecoder.channelDisconnected(ReplayingDecoder.java:450) 

    at: org.jboss.netty.channel.SimpleChannelUpstreamHandler.handleUpstream(SimpleChannelUpstreamHandler.java:112) 

    at: org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:545) 

    at: org.jboss.netty.channel.DefaultChannelPipeline.sendUpstream(DefaultChannelPipeline.java:540) 

    at: org.jboss.netty.channel.Channels.fireChannelDisconnected(Channels.java:360) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.close(NioWorker.java:587) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:356) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:281) 

    at: org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:201) 

    at: org.jboss.netty.util.ThreadRenamingRunnable.run(ThreadRenamingRunnable.java:108) 

    at: org.jboss.netty.util.internal.IoWorkerRunnable.run(IoWorkerRunnable.java:46) 

    at: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) 

    at: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 

    at: java.lang.Thread.run(Thread.java:722) 

Thread Synchronization Statistics: 

----------------------- 

This thread is blocked waiting on lock owned currently by thread named: pool-66-thread-1, id: 41.339 

Number of times this thread was blocked (to enter/reenter a Monitor): 311 

Number of times this thread waited for a notification (i.e. it was in WAITING or TIMED_WAITING state): 7 

Total CPU time for this thread: 0 seconds 156.001.000 nanoseconds. 

User-level CPU time for this thread: 0 seconds 156.001.000 nanoseconds. 

Object Monitors currently held or requested by this thread: [] 

Ownable Synchronizers (e.g. ReentrantLock and ReentrantReadWriteLock) held by this thread: [] 

-------------------------------------------------------------------------------- 

Thread Execution Information: 

----------------------- 

Thread "pool-65-thread-267" thread-id: 46.936 thread-state: TIMED_WAITING Waiting on lock: [email protected] 

    at: sun.misc.Unsafe.park(Native Method) 

    at: java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226) 

    at: java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460) 

    at: java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:359) 

    at: java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:942) 

    at: java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1043) 

    at: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1103) 

    at: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 

    at: java.lang.Thread.run(Thread.java:722) 

Thread Synchronization Statistics: 

----------------------- 

Number of times this thread was blocked (to enter/reenter a Monitor): 3 

Number of times this thread waited for a notification (i.e. it was in WAITING or TIMED_WAITING state): 2 

Total CPU time for this thread: 0 seconds 0 nanoseconds. 

User-level CPU time for this thread: 0 seconds 0 nanoseconds. 

Object Monitors currently held or requested by this thread: [] 

Ownable Synchronizers (e.g. ReentrantLock and ReentrantReadWriteLock) held by this thread: [] 

-------------------------------------------------------------------------------- 

Thread Execution Information: 

----------------------- 

Thread "pool-65-thread-266" thread-id: 46.926 thread-state: TIMED_WAITING Waiting on lock: [email protected] 

    at: sun.misc.Unsafe.park(Native Method) 

    at: java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226) 

    at: java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460) 

    at: java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:359) 

    at: java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:942) 

    at: java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1043) 

    at: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1103) 

    at: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 

    at: java.lang.Thread.run(Thread.java:722) 

Thread Synchronization Statistics: 

----------------------- 

Number of times this thread was blocked (to enter/reenter a Monitor): 3 

Number of times this thread waited for a notification (i.e. it was in WAITING or TIMED_WAITING state): 3 

Total CPU time for this thread: 0 seconds 0 nanoseconds. 

User-level CPU time for this thread: 0 seconds 0 nanoseconds. 

Object Monitors currently held or requested by this thread: [] 

Ownable Synchronizers (e.g. ReentrantLock and ReentrantReadWriteLock) held by this thread: [] 

-------------------------------------------------------------------------------- 

Thread Execution Information: 

----------------------- 

Thread "pool-65-thread-265" thread-id: 46.920 thread-state: TIMED_WAITING Waiting on lock: [email protected] 

    at: sun.misc.Unsafe.park(Native Method) 

    at: java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226) 

    at: java.util.concurrent.SynchronousQueue$TransferStack.awaitFulfill(SynchronousQueue.java:460) 

    at: java.util.concurrent.SynchronousQueue$TransferStack.transfer(SynchronousQueue.java:359) 

    at: java.util.concurrent.SynchronousQueue.poll(SynchronousQueue.java:942) 

    at: java.util.concurrent.ThreadPoolExecutor.getTask(ThreadPoolExecutor.java:1043) 

    at: java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1103) 

    at: java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) 

    at: java.lang.Thread.run(Thread.java:722) 

Thread Synchronization Statistics: 

----------------------- 
+2

關於唯一的真正的治癒是「不去做」。與你的請求相反,每個請求創建一個線程真的是*不*很好。 – 2012-04-11 05:27:15

+0

我必須同意@JerryCoffin。不斷創建,終止和銷燬線程效率低下,浪費,速度慢,容易出錯。處理線程終止的最佳方式是不做。將請求排隊到一個線程池。 – 2012-04-11 07:32:17

回答

相關問題