@Override protected void handleException(Throwable t) { super.handleException(t); Handler<Throwable> handler; synchronized (DatagramSocketImpl.this) { handler = exceptionHandler; } if (handler != null) { handler.handle(t); } }
@Override public void exceptionCaught(ChannelHandlerContext chctx, final Throwable t) throws Exception { Channel ch = chctx.channel(); // Don't remove the connection at this point, or the handleClosed won't be called when channelInactive is called! C connection = getConnection(); if (connection != null) { context.executeFromIO(v -> { try { if (ch.isOpen()) { ch.close(); } } catch (Throwable ignore) { } connection.handleException(t); }); } else { ch.close(); } }
@Override protected void handleException(Throwable t) { super.handleException(t); Handler<Throwable> handler; synchronized (DatagramSocketImpl.this) { handler = exceptionHandler; } if (handler != null) { handler.handle(t); } }
protected void addFuture(final Handler<AsyncResult<Void>> completionHandler, final ChannelFuture future) { if (future != null) { future.addListener(channelFuture -> context.executeFromIO(v -> { if (completionHandler != null) { if (channelFuture.isSuccess()) { completionHandler.handle(Future.succeededFuture()); } else { completionHandler.handle(Future.failedFuture(channelFuture.cause())); } } else if (!channelFuture.isSuccess()) { handleException(channelFuture.cause()); } })); } }
@Override public void exceptionCaught(ChannelHandlerContext chctx, final Throwable t) throws Exception { Channel ch = chctx.channel(); // Don't remove the connection at this point, or the handleClosed won't be called when channelInactive is called! C connection = getConnection(); if (connection != null) { context.executeFromIO(v -> { try { if (ch.isOpen()) { ch.close(); } } catch (Throwable ignore) { } connection.handleException(t); }); } else { ch.close(); } }