Saurabh Jain wrote:
Hi,I am writting a Client-Server application with mina. I am having problem in gracefully shutting down the client. the way i am trying to do is: - The client sends a logout request to the server. - The server does the clean up and closes the connection. - The client is waiting for the connection to be closed by the server. - As soon as the connection is closed the client does the cleanup and exit. The first two steps are fine. But the client is not recieving close notification, due to this the client is hanging. The code is as under: On server side when I recieve LOGOUT: session.close(); On Client Side: GenericRequest req = new GenericRequest(Constants.REQ_LOGOUT, null); WriteFuture future = session.write(req); future.awaitUninterruptibly(); conHandler.shutdown(); pinger.shutDown(); System.out.println("Waiting to close::"); this.session.getCloseFuture().awaitUninterruptibly(); System.out.println("Closed "); The client is hanging on this.session.getCloseFuture().awaitUninterruptibly(); Please let me know what is the right way to gracefully shut down a client application. Thanx, Saurabh
Maybe the client session's CloseFuture is only notified when you call session.close() on the client side. I'm not sure how it's supposed to be. If you use
this.session.close().awaitUninterruptibly(); it might work better? -- Niklas Therning www.spamdrain.net
