Class ExceptionHandler
- java.lang.Object
-
- io.netty.channel.ChannelHandlerAdapter
-
- io.netty.channel.ChannelInboundHandlerAdapter
-
- io.netty.channel.ChannelDuplexHandler
-
- org.drasyl.peer.connection.handler.ExceptionHandler
-
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
,io.netty.channel.ChannelOutboundHandler
public class ExceptionHandler extends io.netty.channel.ChannelDuplexHandler
This handler listens to exceptions on the pipeline and sends them asExceptionMessage
to the peer.
-
-
Field Summary
Fields Modifier and Type Field Description static String
EXCEPTION_HANDLER
-
Constructor Summary
Constructors Constructor Description ExceptionHandler()
Exception handler that does not re-throw occurredException
s onexceptionCaught(io.netty.channel.ChannelHandlerContext, java.lang.Throwable)
to the next pipeline.ExceptionHandler(boolean rethrowExceptions)
Exception handler that does re-throw occurredException
s onexceptionCaught(io.netty.channel.ChannelHandlerContext, java.lang.Throwable)
to the next pipeline, ifrethrowExceptions
istrue
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
bind(io.netty.channel.ChannelHandlerContext ctx, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)
void
close(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)
void
connect(io.netty.channel.ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)
void
deregister(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)
void
disconnect(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)
void
exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
void
write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise)
-
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
-
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharable
-
-
-
-
Field Detail
-
EXCEPTION_HANDLER
public static final String EXCEPTION_HANDLER
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
ExceptionHandler
public ExceptionHandler()
Exception handler that does not re-throw occurredException
s onexceptionCaught(io.netty.channel.ChannelHandlerContext, java.lang.Throwable)
to the next pipeline.
-
ExceptionHandler
public ExceptionHandler(boolean rethrowExceptions)
Exception handler that does re-throw occurredException
s onexceptionCaught(io.netty.channel.ChannelHandlerContext, java.lang.Throwable)
to the next pipeline, ifrethrowExceptions
istrue
.- Parameters:
rethrowExceptions
- iftrue
re-throws to next channel in the pipeline
-
-
Method Detail
-
bind
public void bind(io.netty.channel.ChannelHandlerContext ctx, SocketAddress localAddress, io.netty.channel.ChannelPromise promise) throws Exception
- Specified by:
bind
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
bind
in classio.netty.channel.ChannelDuplexHandler
- Throws:
Exception
-
connect
public void connect(io.netty.channel.ChannelHandlerContext ctx, SocketAddress remoteAddress, SocketAddress localAddress, io.netty.channel.ChannelPromise promise)
- Specified by:
connect
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
connect
in classio.netty.channel.ChannelDuplexHandler
-
disconnect
public void disconnect(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)
- Specified by:
disconnect
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
disconnect
in classio.netty.channel.ChannelDuplexHandler
-
close
public void close(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)
- Specified by:
close
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
close
in classio.netty.channel.ChannelDuplexHandler
-
deregister
public void deregister(io.netty.channel.ChannelHandlerContext ctx, io.netty.channel.ChannelPromise promise)
- Specified by:
deregister
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
deregister
in classio.netty.channel.ChannelDuplexHandler
-
write
public void write(io.netty.channel.ChannelHandlerContext ctx, Object msg, io.netty.channel.ChannelPromise promise)
- Specified by:
write
in interfaceio.netty.channel.ChannelOutboundHandler
- Overrides:
write
in classio.netty.channel.ChannelDuplexHandler
-
exceptionCaught
public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelHandler
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
exceptionCaught
in classio.netty.channel.ChannelInboundHandlerAdapter
-
-