本文整理汇总了Java中org.jboss.netty.channel.ExceptionEvent.getChannel方法的典型用法代码示例。如果您正苦于以下问题:Java ExceptionEvent.getChannel方法的具体用法?Java ExceptionEvent.getChannel怎么用?Java ExceptionEvent.getChannel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jboss.netty.channel.ExceptionEvent
的用法示例。
在下文中一共展示了ExceptionEvent.getChannel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
throws Exception {
Channel ch = e.getChannel();
Throwable cause = e.getCause();
if (cause instanceof TooLongFrameException) {
sendError(ctx, BAD_REQUEST);
return;
} else if (cause instanceof IOException) {
if (cause instanceof ClosedChannelException) {
LOG.debug("Ignoring closed channel error", cause);
return;
}
String message = String.valueOf(cause.getMessage());
if (IGNORABLE_ERROR_MESSAGE.matcher(message).matches()) {
LOG.debug("Ignoring client socket close", cause);
return;
}
}
LOG.error("Shuffle error: ", cause);
if (ch.isConnected()) {
LOG.error("Shuffle error " + e);
sendError(ctx, INTERNAL_SERVER_ERROR);
}
}
示例2: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
throws Exception {
Throwable te = e.getCause();
if (te instanceof java.io.IOException) {// 网络异常,也有可能是soLinger参数引起
return;
}
logger.error("Unexpected exception from downstream.{}", e.getCause());
Channel c = e.getChannel();
try {
if (c.isWritable()) {
RpcResponse res = new RpcResponse();
res.setReturnFlag(RpcConst.ERR_CODE_SERVER_CHANNEL_EXCEPTION);
res.setReturnMsg(logger.getStackTraceInfo(e.getCause()));
c.write(res);
}
} finally {
c.close();
}
// super.exceptionCaught(ctx, e);
}
示例3: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
throws Exception {
Channel ch = e.getChannel();
Throwable cause = e.getCause();
if (cause instanceof TooLongFrameException) {
sendError(ctx, BAD_REQUEST);
return;
}
LOG.error("Shuffle error: ", cause);
shuffleMetrics.failedOutput();
if (ch.isConnected()) {
LOG.error("Shuffle error " + e);
sendError(ctx, INTERNAL_SERVER_ERROR);
}
}
示例4: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught( ChannelHandlerContext ctx, ExceptionEvent e ) throws Exception
{
Channel ch = e.getChannel( ) ;
Throwable cause = e.getCause( ) ;
if( cause instanceof TooLongFrameException )
{
sendError( ctx, BAD_REQUEST ) ;
return ;
}
cause.printStackTrace( ) ;
if( ch.isConnected( ) )
{
sendError( ctx, INTERNAL_SERVER_ERROR ) ;
}
}
示例5: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
throws Exception {
Channel ch = e.getChannel();
Throwable cause = e.getCause();
if (LOG.isDebugEnabled())
LOG.debug(cause.getMessage());
ch.close().addListener(ChannelFutureListener.CLOSE);
}
示例6: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
e.getCause().printStackTrace();
final Channel ch = e.getChannel();
ch.close();
}
示例7: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
// removeFailureCounter(e.getChannel());
if (e.getChannel() != null) {
LOG.info("Channel occur exception {}", e.getChannel().getRemoteAddress());
}
server.closeChannel(e.getChannel());
}
示例8: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
// removeFailureCounter(e.getChannel());
if (e.getChannel() != null) {
LOG.info("Channel occur exception {}", e.getChannel().getRemoteAddress());
}
server.closeChannel(e.getChannel());
}
示例9: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
throws Exception {
Channel ch = e.getChannel();
SocketForwardingWebsocketClient socketClient = (SocketForwardingWebsocketClient) ch.getAttachment();
if (log.isDebugEnabled()) {
log.debug("Received exception from " + ch.getRemoteAddress(),
e.getCause());
}
socketClient.close();
}
示例10: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
throws Exception {
Channel ch = e.getChannel();
Throwable cause = e.getCause();
if (cause instanceof TooLongFrameException) {
sendError(ctx, HttpResponseStatus.BAD_REQUEST);
return;
}
cause.printStackTrace();
if (ch.isConnected()) {
sendError(ctx, HttpResponseStatus.INTERNAL_SERVER_ERROR);
}
}
示例11: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
{
logger.error("Error processing trade", e);
Channel ch = e.getChannel();
ch.close();
}
示例12: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
// removeFailureCounter(e.getChannel());
if (e.getChannel() != null) {
LOG.info("Channel occur exception {}, cause={}", e.getChannel().getRemoteAddress(), e.getCause());
}
server.closeChannel(e.getChannel());
}
示例13: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
Channel ch = e.getChannel();
ch.close();
}
示例14: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) throws Exception {
logger.error("Unexpected Exception happened. event:{}", e, e.getCause());
Channel channel = e.getChannel();
channel.close();
}
示例15: exceptionCaught
import org.jboss.netty.channel.ExceptionEvent; //导入方法依赖的package包/类
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
e.getCause().printStackTrace();
Channel ch = e.getChannel();
ch.close();
}