Package com.linkedin.alpini.netty4.ssl
Class FusedSslHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.handler.codec.ByteToMessageDecoder
-
- io.netty.handler.ssl.SslHandler
-
- com.linkedin.alpini.netty4.ssl.FusedSslHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
,io.netty.channel.ChannelOutboundHandler
public class FusedSslHandler extends io.netty.handler.ssl.SslHandler
An implementation of SslHandler which limits the number of objects held within the pendingUnencryptedWrites queue. This queue is normally very small but when there is some badly behaved code which writes to the channel in a tight loop, we would want to fail further writes so that we don't fall into an OOM situation.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FusedSslHandler.OverflowException
-
Constructor Summary
Constructors Constructor Description FusedSslHandler(javax.net.ssl.SSLEngine engine)
FusedSslHandler(javax.net.ssl.SSLEngine engine, java.util.concurrent.Executor delegatedTaskExecutor)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getOutboundQueueSize()
The length of the outbound queue.int
getOutboundQueueSizeLimit()
void
handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
void
setOutboundQueueSizeLimit(int maxOutboundQueueSize)
void
write(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg, io.netty.channel.ChannelPromise promise)
-
Methods inherited from class io.netty.handler.ssl.SslHandler
applicationProtocol, bind, channelActive, channelInactive, channelReadComplete, close, close, close, closeOutbound, closeOutbound, connect, decode, deregister, disconnect, engine, exceptionCaught, flush, getCloseNotifyFlushTimeoutMillis, getCloseNotifyReadTimeoutMillis, getCloseNotifyTimeoutMillis, getHandshakeTimeoutMillis, handlerRemoved0, handshakeFuture, isEncrypted, read, renegotiate, renegotiate, setCloseNotifyFlushTimeout, setCloseNotifyFlushTimeoutMillis, setCloseNotifyReadTimeout, setCloseNotifyReadTimeoutMillis, setCloseNotifyTimeout, setCloseNotifyTimeoutMillis, setHandshakeTimeout, setHandshakeTimeoutMillis, setWrapDataSize, sslCloseFuture
-
Methods inherited from class io.netty.handler.codec.ByteToMessageDecoder
actualReadableBytes, callDecode, channelRead, decodeLast, discardSomeReadBytes, handlerRemoved, internalBuffer, isSingleDecode, setCumulator, setDiscardAfterReads, setSingleDecode, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelRegistered, channelUnregistered, channelWritabilityChanged
-
-
-
-
Method Detail
-
setOutboundQueueSizeLimit
public void setOutboundQueueSizeLimit(@Nonnegative int maxOutboundQueueSize)
-
getOutboundQueueSizeLimit
public int getOutboundQueueSizeLimit()
-
getOutboundQueueSize
public int getOutboundQueueSize()
The length of the outbound queue. This queue includes both ByteBuf and ChannelPromise objects. This operation is O(1) since the queue is an ArrayDeque.- Returns:
- number of objects in the queue
-
write
public void write(io.netty.channel.ChannelHandlerContext ctx, java.lang.Object msg, io.netty.channel.ChannelPromise promise) throws java.lang.Exception
- Specified by:
write
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
write
in classio.netty.handler.ssl.SslHandler
- Throws:
java.lang.Exception
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) throws java.lang.Exception
- Specified by:
handlerAdded
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerAdded
in classio.netty.handler.ssl.SslHandler
- Throws:
java.lang.Exception
-
-