You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by Pierre-Louis Bonicoli <pb...@anevia.com> on 2007/09/04 17:50:44 UTC

Re: client doesn't stop

Trustin Lee wrote:
> On 8/23/07, Pierre-Louis Bonicoli <pb...@anevia.com> wrote:
>   
>> Hi,
>> I change *a lot* the client parts of the codec tutorial, i keep only two
>> classes : GraphicalCharGenClient and ImageClient (see below).
>>
>> I don't understand why the thread called "SocketConnector" doesn't stop
>> (and so the program doesn't terminate).
>>     
>
> Probably your application will exit after 1 minute (i.e. default
> worker timeout).  Try to set SocketConnector.workerTimeout to smaller
> value (e.g. 5).
>
> HTH,
> Trustin
>   
Hi,
the problem was here (circular strong-reference patterns) :

public class ImageClient extends IoHandlerAdapter
{
[...]
    private SocketConnector connector;
[...]
    public void connect()
    {
        connector.setHandler(this);
        [...]
    }
}

I use a different handler for 'connector', this solve my problem :
connector.setHandler(new MyHandler());
(MyHandler extends IoHandlerAdapter)

Pierre-Louis