Package io.netty.handler.codec.spdy
Class SpdySessionHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.ChannelDuplexHandler
-
- io.netty.handler.codec.spdy.SpdySessionHandler
-
- All Implemented Interfaces:
ChannelHandler,ChannelInboundHandler,ChannelOutboundHandler
public class SpdySessionHandler extends ChannelDuplexHandler
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 io.netty.channel.ChannelHandler
ChannelHandler.Sharable
-
-
Field Summary
Fields Modifier and Type Field Description private ChannelFutureListenercloseSessionFutureListenerprivate static intDEFAULT_MAX_CONCURRENT_STREAMSprivate static intDEFAULT_WINDOW_SIZEprivate intinitialReceiveWindowSizeprivate intinitialSendWindowSizeprivate intinitialSessionReceiveWindowSizeprivate intlastGoodStreamIdprivate intlocalConcurrentStreamsprivate intminorVersionprivate java.util.concurrent.atomic.AtomicIntegerpingsprivate static SpdyProtocolExceptionPROTOCOL_EXCEPTIONprivate booleanreceivedGoAwayFrameprivate intremoteConcurrentStreamsprivate booleansentGoAwayFrameprivate booleanserverprivate SpdySessionspdySessionprivate static SpdyProtocolExceptionSTREAM_CLOSED
-
Constructor Summary
Constructors Constructor Description SpdySessionHandler(SpdyVersion version, boolean server)Creates a new session handler.
-
Method Summary
-
Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, connect, deregister, disconnect, flush, read
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.netty.channel.ChannelHandler
handlerAdded, handlerRemoved
-
-
-
-
Field Detail
-
PROTOCOL_EXCEPTION
private static final SpdyProtocolException PROTOCOL_EXCEPTION
-
STREAM_CLOSED
private static final SpdyProtocolException STREAM_CLOSED
-
DEFAULT_WINDOW_SIZE
private static final int DEFAULT_WINDOW_SIZE
- See Also:
- Constant Field Values
-
initialSendWindowSize
private int initialSendWindowSize
-
initialReceiveWindowSize
private int initialReceiveWindowSize
-
initialSessionReceiveWindowSize
private volatile int initialSessionReceiveWindowSize
-
spdySession
private final SpdySession spdySession
-
lastGoodStreamId
private int lastGoodStreamId
-
DEFAULT_MAX_CONCURRENT_STREAMS
private static final int DEFAULT_MAX_CONCURRENT_STREAMS
- See Also:
- Constant Field Values
-
remoteConcurrentStreams
private int remoteConcurrentStreams
-
localConcurrentStreams
private int localConcurrentStreams
-
pings
private final java.util.concurrent.atomic.AtomicInteger pings
-
sentGoAwayFrame
private boolean sentGoAwayFrame
-
receivedGoAwayFrame
private boolean receivedGoAwayFrame
-
closeSessionFutureListener
private ChannelFutureListener closeSessionFutureListener
-
server
private final boolean server
-
minorVersion
private final int minorVersion
-
-
Constructor Detail
-
SpdySessionHandler
public SpdySessionHandler(SpdyVersion version, boolean server)
Creates a new session handler.- Parameters:
version- 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)
-
channelRead
public void channelRead(ChannelHandlerContext ctx, java.lang.Object msg) throws java.lang.Exception
Description copied from class:ChannelInboundHandlerAdapterCallsChannelHandlerContext.fireChannelRead(Object)to forward to the nextChannelInboundHandlerin theChannelPipeline. Sub-classes may override this method to change behavior.- Specified by:
channelReadin interfaceChannelInboundHandler- Overrides:
channelReadin classChannelInboundHandlerAdapter- Throws:
java.lang.Exception
-
channelInactive
public void channelInactive(ChannelHandlerContext ctx) throws java.lang.Exception
Description copied from class:ChannelInboundHandlerAdapterCallsChannelHandlerContext.fireChannelInactive()to forward to the nextChannelInboundHandlerin theChannelPipeline. Sub-classes may override this method to change behavior.- Specified by:
channelInactivein interfaceChannelInboundHandler- Overrides:
channelInactivein classChannelInboundHandlerAdapter- Throws:
java.lang.Exception
-
exceptionCaught
public void exceptionCaught(ChannelHandlerContext ctx, java.lang.Throwable cause) throws java.lang.Exception
Description copied from class:ChannelInboundHandlerAdapterCallsChannelHandlerContext.fireExceptionCaught(Throwable)to forward to the nextChannelHandlerin theChannelPipeline. Sub-classes may override this method to change behavior.- Specified by:
exceptionCaughtin interfaceChannelHandler- Specified by:
exceptionCaughtin interfaceChannelInboundHandler- Overrides:
exceptionCaughtin classChannelInboundHandlerAdapter- Throws:
java.lang.Exception
-
close
public void close(ChannelHandlerContext ctx, ChannelPromise promise) throws java.lang.Exception
Description copied from class:ChannelDuplexHandlerCallsChannelOutboundInvoker.close(ChannelPromise)to forward to the nextChannelOutboundHandlerin theChannelPipeline. Sub-classes may override this method to change behavior.- Specified by:
closein interfaceChannelOutboundHandler- Overrides:
closein classChannelDuplexHandler- Parameters:
ctx- theChannelHandlerContextfor which the close operation is madepromise- theChannelPromiseto notify once the operation completes- Throws:
java.lang.Exception- thrown if an error occurs
-
write
public void write(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise) throws java.lang.Exception
Description copied from class:ChannelDuplexHandlerCallsChannelOutboundInvoker.write(Object, ChannelPromise)to forward to the nextChannelOutboundHandlerin theChannelPipeline. Sub-classes may override this method to change behavior.- Specified by:
writein interfaceChannelOutboundHandler- Overrides:
writein classChannelDuplexHandler- Parameters:
ctx- theChannelHandlerContextfor which the write operation is mademsg- the message to writepromise- theChannelPromiseto notify once the operation completes- Throws:
java.lang.Exception- thrown if an error occurs
-
handleOutboundMessage
private void handleOutboundMessage(ChannelHandlerContext ctx, java.lang.Object msg, ChannelPromise promise) throws java.lang.Exception
- Throws:
java.lang.Exception
-
issueSessionError
private void issueSessionError(ChannelHandlerContext ctx, SpdySessionStatus status)
-
issueStreamError
private void issueStreamError(ChannelHandlerContext ctx, 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, ChannelPromise future)
-
sendGoAwayFrame
private ChannelFuture sendGoAwayFrame(ChannelHandlerContext ctx, SpdySessionStatus status)
-
-