Class HandlerSubscriber<T>
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.ChannelDuplexHandler
-
- software.amazon.awssdk.http.nio.netty.internal.nrs.HandlerSubscriber<T>
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
,io.netty.channel.ChannelOutboundHandler
,org.reactivestreams.Subscriber<T>
public class HandlerSubscriber<T> extends io.netty.channel.ChannelDuplexHandler implements org.reactivestreams.Subscriber<T>
Subscriber that publishes received messages to the handler pipeline. This class contains source imported from https://github.com/playframework/netty-reactive-streams, licensed under the Apache License 2.0, available at the time of the fork (1/31/2020) here: https://github.com/playframework/netty-reactive-streams/blob/master/LICENSE.txt All original source licensed under the Apache License 2.0 by playframework. All modifications are licensed under the Apache License 2.0 by Amazon Web Services.
-
-
Constructor Summary
Constructors Constructor Description HandlerSubscriber(io.netty.util.concurrent.EventExecutor executor)
Create a new handler subscriber with the default low and high watermarks.HandlerSubscriber(io.netty.util.concurrent.EventExecutor executor, long demandLowWatermark, long demandHighWatermark)
Create a new handler subscriber.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
channelActive(io.netty.channel.ChannelHandlerContext ctx)
void
channelInactive(io.netty.channel.ChannelHandlerContext ctx)
void
channelRegistered(io.netty.channel.ChannelHandlerContext ctx)
void
channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx)
protected void
complete()
Override for custom completion handling.protected void
error(Throwable error)
Override for custom error handling.void
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
void
handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
void
handlerRemoved(io.netty.channel.ChannelHandlerContext ctx)
void
onComplete()
void
onError(Throwable error)
void
onNext(T t)
void
onSubscribe(org.reactivestreams.Subscription subscription)
-
Methods inherited from class io.netty.channel.ChannelDuplexHandler
bind, close, connect, deregister, disconnect, flush, read, write
-
-
-
-
Constructor Detail
-
HandlerSubscriber
public HandlerSubscriber(io.netty.util.concurrent.EventExecutor executor, long demandLowWatermark, long demandHighWatermark)
Create a new handler subscriber. The supplied executor must be the same event loop as the event loop that this handler is eventually registered with, if not, an exception will be thrown when the handler is registered.- Parameters:
executor
- The executor to execute asynchronous events from the publisher on.demandLowWatermark
- The low watermark for demand. When demand drops below this, more will be requested.demandHighWatermark
- The high watermark for demand. This is the maximum that will be requested.
-
HandlerSubscriber
public HandlerSubscriber(io.netty.util.concurrent.EventExecutor executor)
Create a new handler subscriber with the default low and high watermarks. The supplied executor must be the same event loop as the event loop that this handler is eventually registered with, if not, an exception will be thrown when the handler is registered.- Parameters:
executor
- The executor to execute asynchronous events from the publisher on.- See Also:
HandlerSubscriber(EventExecutor, long, long)
-
-
Method Detail
-
error
protected void error(Throwable error)
Override for custom error handling. By default, it closes the channel.- Parameters:
error
- The error to handle.
-
complete
protected void complete()
Override for custom completion handling. By default, it closes the channel.
-
handlerAdded
public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) throws Exception
- Specified by:
handlerAdded
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerAdded
in classio.netty.channel.ChannelHandlerAdapter
- Throws:
Exception
-
channelRegistered
public void channelRegistered(io.netty.channel.ChannelHandlerContext ctx) throws Exception
- Specified by:
channelRegistered
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelRegistered
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
channelWritabilityChanged
public void channelWritabilityChanged(io.netty.channel.ChannelHandlerContext ctx) throws Exception
- Specified by:
channelWritabilityChanged
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelWritabilityChanged
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
channelActive
public void channelActive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
- Specified by:
channelActive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelActive
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
channelInactive
public void channelInactive(io.netty.channel.ChannelHandlerContext ctx) throws Exception
- Specified by:
channelInactive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelInactive
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
handlerRemoved
public void handlerRemoved(io.netty.channel.ChannelHandlerContext ctx) throws Exception
- Specified by:
handlerRemoved
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerRemoved
in classio.netty.channel.ChannelHandlerAdapter
- Throws:
Exception
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) throws Exception
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelHandler
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
exceptionCaught
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
onSubscribe
public void onSubscribe(org.reactivestreams.Subscription subscription)
- Specified by:
onSubscribe
in interfaceorg.reactivestreams.Subscriber<T>
-
onError
public void onError(Throwable error)
- Specified by:
onError
in interfaceorg.reactivestreams.Subscriber<T>
-
onComplete
public void onComplete()
- Specified by:
onComplete
in interfaceorg.reactivestreams.Subscriber<T>
-
-