项目:Pulse
文件:PCSession.java
@Override
public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) {
String message;
if (!(cause instanceof ConnectTimeoutException) && (!(cause instanceof ConnectException) || !cause.getMessage()
.contains("connection timed out"))) {
if (cause instanceof ReadTimeoutException) {
message = "Read timed out.";
} else if (cause instanceof WriteTimeoutException) {
message = "Write timed out.";
} else {
message = "Internal network exception.";
}
} else {
message = "Connection timed out.";
}
this.disconnect(message,cause);
}
项目:netty-socks
文件:RWTimeoutExceptionHandler.java
@Override
public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) throws Exception {
if (cause instanceof ReadTimeoutException) {
handleReadTimeout(ctx);
} else if (cause instanceof WriteTimeoutException) {
handleWriteTimeout(ctx);
} else {
super.exceptionCaught(ctx,cause);
}
}
项目:statsd-netty
文件:WriteTimeoutFlushHandler.java
@Override
public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause)
throws Exception {
if (cause instanceof WriteTimeoutException) {
LOGGER.debug("Timeout flush");
ctx.flush();
} else {
super.exceptionCaught(ctx,cause);
}
}
项目:PacketLib
文件:TcpSession.java
@Override
public void exceptionCaught(ChannelHandlerContext ctx,Throwable cause) {
String message = null;
if(cause instanceof ConnectTimeoutException || (cause instanceof ConnectException && cause.getMessage().contains("connection timed out"))) {
message = "Connection timed out.";
} else if(cause instanceof ReadTimeoutException) {
message = "Read timed out.";
} else if(cause instanceof WriteTimeoutException) {
message = "Write timed out.";
} else {
message = cause.toString();
}
this.disconnect(message,cause);
}