org.webbitserver.netty
Class StaleConnectionTrackingHandler

java.lang.Object
  extended by org.jboss.netty.channel.SimpleChannelHandler
      extended by org.webbitserver.netty.StaleConnectionTrackingHandler
All Implemented Interfaces:
org.jboss.netty.channel.ChannelDownstreamHandler, org.jboss.netty.channel.ChannelHandler, org.jboss.netty.channel.ChannelUpstreamHandler

public class StaleConnectionTrackingHandler
extends org.jboss.netty.channel.SimpleChannelHandler

Keeps track of all connections and automatically closes the ones that are stale.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
org.jboss.netty.channel.ChannelHandler.Sharable
 
Constructor Summary
StaleConnectionTrackingHandler(long timeout, Executor executor)
           
 
Method Summary
 void channelOpen(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.ChannelStateEvent e)
           
 void closeStaleConnections()
           
 void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx, org.jboss.netty.channel.MessageEvent e)
           
 void stopTracking(org.jboss.netty.channel.Channel channel)
          Stops tracking this channel for staleness.
 
Methods inherited from class org.jboss.netty.channel.SimpleChannelHandler
bindRequested, channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelUnbound, childChannelClosed, childChannelOpen, closeRequested, connectRequested, disconnectRequested, exceptionCaught, handleDownstream, handleUpstream, setInterestOpsRequested, unbindRequested, writeComplete, writeRequested
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StaleConnectionTrackingHandler

public StaleConnectionTrackingHandler(long timeout,
                                      Executor executor)
Method Detail

channelOpen

public void channelOpen(org.jboss.netty.channel.ChannelHandlerContext ctx,
                        org.jboss.netty.channel.ChannelStateEvent e)
                 throws Exception
Overrides:
channelOpen in class org.jboss.netty.channel.SimpleChannelHandler
Throws:
Exception

messageReceived

public void messageReceived(org.jboss.netty.channel.ChannelHandlerContext ctx,
                            org.jboss.netty.channel.MessageEvent e)
                     throws Exception
Overrides:
messageReceived in class org.jboss.netty.channel.SimpleChannelHandler
Throws:
Exception

closeStaleConnections

public void closeStaleConnections()

stopTracking

public void stopTracking(org.jboss.netty.channel.Channel channel)
Stops tracking this channel for staleness. This happens for WebSockets and EventSource connections.

Parameters:
channel -


Copyright © 2012. All Rights Reserved.