netty doubts

Frederic Bregier fredbregier at free.fr
Sat Sep 12 03:49:24 EDT 2009


Hi Mangala,

We didn't get your code (the ML filter blocking it).
However, I think the main idea is one thing I've implemented in the past.

Like you I add a shutdown hook in the server part. When the shutdown hook is
called, I send a "I'm in shutdown" message to all connected clients, so that
they can stop and close easily their connection. I wait then a bit (let say
10 seconds) in order to give some time for all clients to disconnect
properly and continue with the shutdown process.

Another possibility, faster, if this is correct for your business, when the
shutdown hook is called, the server closes all connected client, thus
relying on the handler on client side to stop correctly the business part
with the channelClosed or exceptionCaught methods (or both like trapping the
exception first then letting the channelClosed do the job). Then in the
server you don't have to wait a bit.

In both solution, you have to maintain a global list of current client
connections on server side.

HTH,
Frederic


mangalatth wrote:
> 
> Hi
> 
> I want to shutdown server  while doing so I want to close all the clients
> associated with the server. Please check the attached file which will have
> the code.
> SubscriberQueryServer==> server program which have shutdown hook of java
> but when shutting down its not closing client connection its giving
> IOException
> 
> OpenCLient-==> client program which will send some message to server
> 
> 
> Please help
> 
> Regards
> Mangala
> 
> ________________________________
> "DISCLAIMER: This message is proprietary to Aricent and is intended solely
> for the use of the individual to whom it is addressed. It may contain
> privileged or confidential information and should not be circulated or
> used for any purpose other than for what it is intended. If you have
> received this message in error,please notify the originator immediately.
> If you are not the intended recipient, you are notified that you are
> strictly prohibited from using, copying, altering, or disclosing the
> contents of this message. Aricent accepts no responsibility for loss or
> damage arising from the use of the information transmitted by this email
> including damage from virus."
> 
> _______________________________________________
> netty-dev mailing list
> netty-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-dev
> 
> 


-----
Hardware/Software Architect
-- 
View this message in context: http://n2.nabble.com/netty-doubts-tp3628873p3630854.html
Sent from the Netty Developer Group mailing list archive at Nabble.com.


More information about the netty-dev mailing list