Le 24/06/16 à 10:50, Simo Chiegang, Boris Arthur a écrit : > I Guys, > > I have a server and I called to stop the server: > > Acceptor.dispose(true); > > But the call never come back. I don't know why: > > java.lang.Thread.State: TIMED_WAITING (parking) > at sun.misc.Unsafe.park(Native Method) > - parking to wait for <0x00000000f94bcd30> (a > java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject) > at > java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:215) > at > java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2078) > at > java.util.concurrent.ThreadPoolExecutor.awaitTermination(ThreadPoolExecutor.java:1465) > at > org.apache.mina.core.service.AbstractIoService.dispose(AbstractIoService.java:307) > at > com.heidelberg.lvis.printdevice.sub.samba3.simu.DummySamba3JsonRpcServer.stop(DummySamba3JsonRpcServer.java:203) > at > test.heidelberg.lvis.printdevice.devices.TestUtilsSamba3.stopHardwareSimulation(TestUtilsSamba3.java:110) > at > test.heidelberg.lvis.printdevice.devices.Samba3HeadTemperatureTest.tearDown(Samba3HeadTemperatureTest.java:58) > > I thinks, it must sure that this blocking call come back. Can you tell me in > which case this can indefinitely block?.
Because you have explicitely called for it. Passing 'true' tells the dispose to wait for all the sessions to complete : "Releases any resources allocated by this service. Please note that this method might block as long as there are any sessions managed by this service. Warning : calling this method from a IoFutureListener with awaitTermination = true will probably lead to a deadlock." Pass 'false'.