Class SpdySessionHandler
- java.lang.Object
-
- org.jboss.netty.channel.SimpleChannelUpstreamHandler
-
- org.jboss.netty.handler.codec.spdy.SpdySessionHandler
-
- All Implemented Interfaces:
ChannelDownstreamHandler,ChannelHandler,ChannelUpstreamHandler
public class SpdySessionHandler extends SimpleChannelUpstreamHandler implements ChannelDownstreamHandler
Manages streams within a SPDY session.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSpdySessionHandler.ClosingChannelFutureListener-
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Field Summary
Fields Modifier and Type Field Description private ChannelFutureListenercloseSessionFutureListenerprivate static intDEFAULT_MAX_CONCURRENT_STREAMSprivate static intDEFAULT_WINDOW_SIZEprivate java.lang.ObjectflowControlLockprivate intinitialReceiveWindowSizeprivate intinitialSendWindowSizeprivate intinitialSessionReceiveWindowSizeprivate intlastGoodStreamIdprivate intlocalConcurrentStreamsprivate intminorVersionprivate java.util.concurrent.atomic.AtomicIntegerpingsprivate static SpdyProtocolExceptionPROTOCOL_EXCEPTIONprivate booleanreceivedGoAwayFrameprivate intremoteConcurrentStreamsprivate booleansentGoAwayFrameprivate booleanserverprivate SpdySessionspdySession
-
Constructor Summary
Constructors Constructor Description SpdySessionHandler(SpdyVersion spdyVersion, boolean server)Creates a new session handler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private booleanacceptStream(int streamId, byte priority, boolean remoteSideClosed, boolean localSideClosed)voidexceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)Invoked when an exception was raised by an I/O thread or aChannelHandler.private voidhalfCloseStream(int streamId, boolean remote, ChannelFuture future)voidhandleDownstream(ChannelHandlerContext ctx, ChannelEvent evt)Handles the specified downstream event.private booleanisRemoteInitiatedId(int id)private voidissueSessionError(ChannelHandlerContext ctx, Channel channel, java.net.SocketAddress remoteAddress, SpdySessionStatus status)private voidissueStreamError(ChannelHandlerContext ctx, java.net.SocketAddress remoteAddress, int streamId, SpdyStreamStatus status)voidmessageReceived(ChannelHandlerContext ctx, MessageEvent e)Invoked when a message object (e.g:ChannelBuffer) was received from a remote peer.private voidremoveStream(int streamId, ChannelFuture future)private ChannelFuturesendGoAwayFrame(ChannelHandlerContext ctx, Channel channel, java.net.SocketAddress remoteAddress, SpdySessionStatus status)private voidsendGoAwayFrame(ChannelHandlerContext ctx, ChannelStateEvent e)voidsetSessionReceiveWindowSize(int sessionReceiveWindowSize)private voidupdateInitialReceiveWindowSize(int newInitialWindowSize)private voidupdateInitialSendWindowSize(int newInitialWindowSize)private voidupdateSendWindowSize(ChannelHandlerContext ctx, int streamId, int deltaWindowSize)-
Methods inherited from class org.jboss.netty.channel.SimpleChannelUpstreamHandler
channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, handleUpstream, writeComplete
-
-
-
-
Field Detail
-
PROTOCOL_EXCEPTION
private static final SpdyProtocolException PROTOCOL_EXCEPTION
-
DEFAULT_WINDOW_SIZE
private static final int DEFAULT_WINDOW_SIZE
- See Also:
- Constant Field Values
-
initialSendWindowSize
private volatile int initialSendWindowSize
-
initialReceiveWindowSize
private volatile int initialReceiveWindowSize
-
initialSessionReceiveWindowSize
private volatile int initialSessionReceiveWindowSize
-
spdySession
private final SpdySession spdySession
-
lastGoodStreamId
private volatile int lastGoodStreamId
-
DEFAULT_MAX_CONCURRENT_STREAMS
private static final int DEFAULT_MAX_CONCURRENT_STREAMS
- See Also:
- Constant Field Values
-
remoteConcurrentStreams
private volatile int remoteConcurrentStreams
-
localConcurrentStreams
private volatile int localConcurrentStreams
-
flowControlLock
private final java.lang.Object flowControlLock
-
pings
private final java.util.concurrent.atomic.AtomicInteger pings
-
sentGoAwayFrame
private volatile boolean sentGoAwayFrame
-
receivedGoAwayFrame
private volatile boolean receivedGoAwayFrame
-
closeSessionFutureListener
private volatile ChannelFutureListener closeSessionFutureListener
-
server
private final boolean server
-
minorVersion
private final int minorVersion
-
-
Constructor Detail
-
SpdySessionHandler
public SpdySessionHandler(SpdyVersion spdyVersion, boolean server)
Creates a new session handler.- Parameters:
spdyVersion- the protocol versionserver-trueif and only if this session handler should handle the server endpoint of the connection.falseif and only if this session handler should handle the client endpoint of the connection.
-
-
Method Detail
-
setSessionReceiveWindowSize
public void setSessionReceiveWindowSize(int sessionReceiveWindowSize)
-
messageReceived
public void messageReceived(ChannelHandlerContext ctx, MessageEvent e) throws java.lang.Exception
Description copied from class:SimpleChannelUpstreamHandlerInvoked when a message object (e.g:ChannelBuffer) was received from a remote peer.- Overrides:
messageReceivedin classSimpleChannelUpstreamHandler- Throws:
java.lang.Exception
-
exceptionCaught
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws java.lang.Exception
Description copied from class:SimpleChannelUpstreamHandlerInvoked when an exception was raised by an I/O thread or aChannelHandler.- Overrides:
exceptionCaughtin classSimpleChannelUpstreamHandler- Throws:
java.lang.Exception
-
handleDownstream
public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent evt) throws java.lang.Exception
Description copied from interface:ChannelDownstreamHandlerHandles the specified downstream event.- Specified by:
handleDownstreamin interfaceChannelDownstreamHandler- Parameters:
ctx- the context object for this handlerevt- the downstream event to process or intercept- Throws:
java.lang.Exception
-
issueSessionError
private void issueSessionError(ChannelHandlerContext ctx, Channel channel, java.net.SocketAddress remoteAddress, SpdySessionStatus status)
-
issueStreamError
private void issueStreamError(ChannelHandlerContext ctx, java.net.SocketAddress remoteAddress, int streamId, SpdyStreamStatus status)
-
isRemoteInitiatedId
private boolean isRemoteInitiatedId(int id)
-
updateInitialSendWindowSize
private void updateInitialSendWindowSize(int newInitialWindowSize)
-
updateInitialReceiveWindowSize
private void updateInitialReceiveWindowSize(int newInitialWindowSize)
-
acceptStream
private boolean acceptStream(int streamId, byte priority, boolean remoteSideClosed, boolean localSideClosed)
-
halfCloseStream
private void halfCloseStream(int streamId, boolean remote, ChannelFuture future)
-
removeStream
private void removeStream(int streamId, ChannelFuture future)
-
updateSendWindowSize
private void updateSendWindowSize(ChannelHandlerContext ctx, int streamId, int deltaWindowSize)
-
sendGoAwayFrame
private void sendGoAwayFrame(ChannelHandlerContext ctx, ChannelStateEvent e)
-
sendGoAwayFrame
private ChannelFuture sendGoAwayFrame(ChannelHandlerContext ctx, Channel channel, java.net.SocketAddress remoteAddress, SpdySessionStatus status)
-
-