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 class
SpdySessionHandler.ClosingChannelFutureListener
-
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Field Summary
Fields Modifier and Type Field Description private ChannelFutureListener
closeSessionFutureListener
private static int
DEFAULT_MAX_CONCURRENT_STREAMS
private static int
DEFAULT_WINDOW_SIZE
private java.lang.Object
flowControlLock
private int
initialReceiveWindowSize
private int
initialSendWindowSize
private int
initialSessionReceiveWindowSize
private int
lastGoodStreamId
private int
localConcurrentStreams
private int
minorVersion
private java.util.concurrent.atomic.AtomicInteger
pings
private static SpdyProtocolException
PROTOCOL_EXCEPTION
private boolean
receivedGoAwayFrame
private int
remoteConcurrentStreams
private boolean
sentGoAwayFrame
private boolean
server
private SpdySession
spdySession
-
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 boolean
acceptStream(int streamId, byte priority, boolean remoteSideClosed, boolean localSideClosed)
void
exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
Invoked when an exception was raised by an I/O thread or aChannelHandler
.private void
halfCloseStream(int streamId, boolean remote, ChannelFuture future)
void
handleDownstream(ChannelHandlerContext ctx, ChannelEvent evt)
Handles the specified downstream event.private boolean
isRemoteInitiatedId(int id)
private void
issueSessionError(ChannelHandlerContext ctx, Channel channel, java.net.SocketAddress remoteAddress, SpdySessionStatus status)
private void
issueStreamError(ChannelHandlerContext ctx, java.net.SocketAddress remoteAddress, int streamId, SpdyStreamStatus status)
void
messageReceived(ChannelHandlerContext ctx, MessageEvent e)
Invoked when a message object (e.g:ChannelBuffer
) was received from a remote peer.private void
removeStream(int streamId, ChannelFuture future)
private ChannelFuture
sendGoAwayFrame(ChannelHandlerContext ctx, Channel channel, java.net.SocketAddress remoteAddress, SpdySessionStatus status)
private void
sendGoAwayFrame(ChannelHandlerContext ctx, ChannelStateEvent e)
void
setSessionReceiveWindowSize(int sessionReceiveWindowSize)
private void
updateInitialReceiveWindowSize(int newInitialWindowSize)
private void
updateInitialSendWindowSize(int newInitialWindowSize)
private void
updateSendWindowSize(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
-true
if and only if this session handler should handle the server endpoint of the connection.false
if 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:SimpleChannelUpstreamHandler
Invoked when a message object (e.g:ChannelBuffer
) was received from a remote peer.- Overrides:
messageReceived
in classSimpleChannelUpstreamHandler
- Throws:
java.lang.Exception
-
exceptionCaught
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws java.lang.Exception
Description copied from class:SimpleChannelUpstreamHandler
Invoked when an exception was raised by an I/O thread or aChannelHandler
.- Overrides:
exceptionCaught
in classSimpleChannelUpstreamHandler
- Throws:
java.lang.Exception
-
handleDownstream
public void handleDownstream(ChannelHandlerContext ctx, ChannelEvent evt) throws java.lang.Exception
Description copied from interface:ChannelDownstreamHandler
Handles the specified downstream event.- Specified by:
handleDownstream
in 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)
-
-