本文整理匯總了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();
}