Hi Mladen,

On Nov 22, 2007 6:18 PM, Mladen Turk <[EMAIL PROTECTED]> wrote:
> Trustin Lee wrote:
> >>
> >> First thing I would add would be the unlock for Socket.accept
> >> (something each Acceptor, not only APR should have)
> >> and make sure that Socket.close for the acceptor socket is called even
> >> on the CTRL+C. After all native calls are exited, then you can safely
> >> call the Library.shutdown
> >
> > Doesn't OS release any resources allocated by a process when the
> > process quits or dies?  Do I really need to call Library.shutdown()?
> > Am I missing something?
> >
>
> Sure OS will release resources. However APR has set of
> internal cleanup callbacks, so when you call Library.terminate or
> destroy an Pool, all the object will be gracefully closed
> by their corresponding callback.
> The hard close might leave temporary files not removed.
> Sockets are hard closed instead shutdown thus not
> sending FIN packets, etc...
>
> So, it's always better to do it gracefully rather then
> depending on the OS.

You are right.  My concern is actually the case that user uses
tomcat-native in a different module than MINA.  Then things can get
mixed up so making MINA to register the shutdown hook or call
Library.terminate explicitly might be a bad decision.  Is there any
elegant way to take care of this case (i.e. multi APR-based
applications in a container)?

Thanks,
Trustin
-- 
what we call human nature is actually human habit
--
http://gleamynode.net/
--
PGP Key ID: 0x0255ECA6

Reply via email to