Author: norman
Date: Tue Feb 15 17:06:27 2011
New Revision: 1070971

URL: http://svn.apache.org/viewvc?rev=1070971&view=rev
Log:
Make sure ImapSession is removed from ChannelLocal once the Channel is closed. 
See JAMES-1195

Modified:
    
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java

Modified: 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java
URL: 
http://svn.apache.org/viewvc/james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java?rev=1070971&r1=1070970&r2=1070971&view=diff
==============================================================================
--- 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java
 (original)
+++ 
james/server/trunk/imapserver/src/main/java/org/apache/james/imapserver/netty/ImapChannelUpstreamHandler.java
 Tue Feb 15 17:06:27 2011
@@ -97,6 +97,11 @@ public class ImapChannelUpstreamHandler 
     public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) 
throws Exception {
         InetSocketAddress address = (InetSocketAddress) 
ctx.getChannel().getRemoteAddress();
         getLogger(ctx.getChannel()).info("Connection closed for " + 
address.getHostName() + " (" + address.getAddress().getHostAddress()+ ")");
+        
+        // remove the stored attribute for the channel to free up resources
+        // See JAMES-1195
+        ImapSession imapSession = (ImapSession) 
attributes.remove(ctx.getChannel());
+        if (imapSession != null) imapSession.logout();
 
         super.channelClosed(ctx, e);
     }



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to