Hi Trustin, > Then request.done is set to true, so we don't call wait() at all. Please > search for 'request.done = true' in the source code. It is also in a > synchronized block. I can't think of a scenario this code blocks forever. > I have seen this kind of 'synchronized' block. It works fine when I did bind only one port for an instance of SocketAcceptor. But when I did bind more than one ports to, the thread is blocked at the 'request.wait()' (I have added the log message for each stepped and I saw in the log file: the 'request.wait()' never returned).
Thanks & best regards, Hieu Phan. > -----Original Message----- > From: Trustin Lee [mailto:[EMAIL PROTECTED] > Sent: Tuesday, November 07, 2006 8:08 AM > To: [email protected] > Subject: Re: [MINA 1.0.0] Could not stop listening on Port > > On 11/7/06, peter royal <[EMAIL PROTECTED]> wrote: > > > > >> To solve this problem, I think that we should review the source code > > >> more carefully. > > >> > > >> I don't know exactly. > > >> But IMO in the "unbind" method we have the "request.wait()" here. > > >> What will happened if the "notify" thread is happened before the > > > "wait" > > >> thread? The "unbind" method will be never returned? > > > Then request.done is set to true, so we don't call wait() at all. Please > search for 'request.done = true' in the source code. It is also in a > synchronized block. I can't think of a scenario this code blocks forever. > > >> > > >> --BEGIN-- > > >> synchronized( request ) > > >> { > > >> while( !request.done ) > > >> { > > >> try > > >> { > > >> request.wait(); > > >> } > > >> catch( InterruptedException e ) > > >> { > > >> ExceptionMonitor.getInstance().exceptionCaught( e > > > ); > > >> } > > >> } > > >> } > > >> --END-- > > > > This should be fixed in the 1.2 branch, as it now uses a > > CountDownLatch to indicate completion. > > > We can use CountDownLatch, but the initial count will always be 1. What > is > the advantage in using it? > > Trustin > -- > what we call human nature is actually human habit > -- > http://gleamynode.net/ > -- > PGP key fingerprints: > * E167 E6AF E73A CBCE EE41 4A29 544D DE48 FE95 4E7E > * B693 628E 6047 4F8F CFA4 455E 1C62 A7DC 0255 ECA6
