When i try to use close at client side then i get a
java.security.AccessControlException: access denied
(java.lang.RuntimePermission modifyThread) due to the Security manager
implementation of my application. Does close operation require any specific
permissions?

Also I have gone through the examples and i think this is the same mechanism
used in the examples. (May be I have missed something [:(]  ) I followed the
chat example.

Saurabh.


Niklas Therning wrote:
> 
> 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
> 
> 
> -----
> Niklas Therning
> www.spamdrain.net
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-gracefully-shutdown-a-connection-from-client-tp15189221s16868p15211665.html
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.

Reply via email to