@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { String msg; if (cause instanceof TimeoutException) { msg = "timeout"; } else { msg = "unknown"; } this.closeChannel(msg); }
public void shutdown() { if (cg != null) { cg.close().awaitUninterruptibly(); cg = null; } bootstrap = null; pipelineFactory = null; if (workerExecutor != null) { try { workerExecutor.shutdownGracefully(); } catch (TimeoutException e) { logger.warn("Error waiting for gracefull shutdown of BootstrapClient {}", e); } workerExecutor = null; } if (timer != null) { timer.stop(); timer = null; } }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { // Pipeline error, just log it if (cause instanceof CodecException) { Lantern.getLogger().error("A netty pipeline error occurred", cause); } else { if (cause instanceof IOException) { final StackTraceElement[] stack = cause.getStackTrace(); if (stack.length != 0 && stack[0].toString().startsWith("sun.nio.ch.SocketDispatcher.read0")) { return; } } // Use the debug level, don't spam the server with errors // caused by client disconnection, ... Lantern.getLogger().debug("A netty connection error occurred", cause); if (cause instanceof TimeoutException) { closeChannel(t("disconnect.timeout")); } else { closeChannel(t("disconnect.genericReason", "Internal Exception: " + cause)); } } }
public void exceptionCaught(ChannelHandlerContext p_exceptionCaught_1_, Throwable p_exceptionCaught_2_) throws Exception { TextComponentTranslation textcomponenttranslation; if (p_exceptionCaught_2_ instanceof TimeoutException) { textcomponenttranslation = new TextComponentTranslation("disconnect.timeout", new Object[0]); } else { textcomponenttranslation = new TextComponentTranslation("disconnect.genericReason", new Object[] {"Internal Exception: " + p_exceptionCaught_2_}); } LOGGER.debug((Object)p_exceptionCaught_2_); this.closeChannel(textcomponenttranslation); }
@BeforeClass public static void setUp() throws IOException, URISyntaxException, TimeoutException { CLUSTER = new MiniDFSCluster.Builder(CONF).numDataNodes(1).build(); CLUSTER.waitActive(); RESPONSE_HANDLER = new Http2ResponseHandler(); Bootstrap bootstrap = new Bootstrap() .group(WORKER_GROUP) .channel(NioSocketChannel.class) .remoteAddress("127.0.0.1", CLUSTER.getDataNodes().get(0).getInfoPort()) .handler(new ChannelInitializer<Channel>() { @Override protected void initChannel(Channel ch) throws Exception { Http2Connection connection = new DefaultHttp2Connection(false); Http2ConnectionHandler connectionHandler = new HttpToHttp2ConnectionHandler(connection, frameReader(), frameWriter(), new DelegatingDecompressorFrameListener( connection, new InboundHttp2ToHttpAdapter.Builder( connection).maxContentLength(Integer.MAX_VALUE) .propagateSettings(true).build())); ch.pipeline().addLast(connectionHandler, RESPONSE_HANDLER); } }); CHANNEL = bootstrap.connect().syncUninterruptibly().channel(); }
@Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { ChannelUtil.closeOnFlush(ctx.channel()); // Ignore IO and timeout related exceptions if (!(cause instanceof IOException) && !(cause instanceof TimeoutException)) { logger.error(cause.getMessage(), cause); } }
public void exceptionCaught(ChannelHandlerContext p_exceptionCaught_1_, Throwable p_exceptionCaught_2_) { ChatComponentTranslation chatcomponenttranslation; if (p_exceptionCaught_2_ instanceof TimeoutException) { chatcomponenttranslation = new ChatComponentTranslation("disconnect.timeout", new Object[0]); } else { chatcomponenttranslation = new ChatComponentTranslation("disconnect.genericReason", new Object[] {"Internal Exception: " + p_exceptionCaught_2_}); } this.closeChannel(chatcomponenttranslation); }
public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) throws Exception { ChatMessage chatmessage; if (throwable instanceof TimeoutException) { chatmessage = new ChatMessage("disconnect.timeout", new Object[0]); } else { chatmessage = new ChatMessage("disconnect.genericReason", new Object[] { "Internal Exception: " + throwable}); } NetworkManager.g.debug(throwable); this.close(chatmessage); if (MinecraftServer.getServer().isDebugging()) throwable.printStackTrace(); // Spigot }