You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by peter royal <pr...@apache.org> on 2006/08/20 20:26:54 UTC

Re: [mina] Must I create my own threads?

(cc'ing mina-dev, since mina has its own list now)

On Aug 10, 2006, at 3:25 AM, Marc Anthony Winoto wrote:
> I have read the Mina online tut and got my own simple client-server  
> setup. It's pretty much a copy of the echo example.
>
> When I run the server, it exits the main method and never spends  
> any time listening. If I put in infinite loop at the end of the  
> main method and start the client, we can see that the setup int the  
> server main() was correct.
>
> I tried running the examples and I get the same result: setup the  
> server, print out listening port, exit.
>
> Am I supposed to create a new thread and call some method which  
> blocks or something?

That's one way.

Another way is to use the ExecutorThreadPool in the java5 module in  
svn. Since by default its threads are non-daemon, it will be enough  
to keep the JVM alive.

-pete


-- 
proyal@apache.org - http://fotap.org/~osi