io.netty.channel.ChannelFuture.cause()方法的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中io.netty.channel.ChannelFuture.cause()方法的一些代码示例,展示了ChannelFuture.cause()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ChannelFuture.cause()方法的具体详情如下:
包路径:io.netty.channel.ChannelFuture
类名称:ChannelFuture
方法名:cause

ChannelFuture.cause介绍

暂无

代码示例

代码示例来源:origin: netty/netty

@Override
  public void operationComplete(ChannelFuture future) throws Exception {
    if (!future.isSuccess()) {
      forceClose(child, future.cause());
    }
  }
});

代码示例来源:origin: netty/netty

@Override
  public void operationComplete(ChannelFuture future) {
    if (!future.isSuccess()) {
      future.channel().pipeline().fireExceptionCaught(future.cause());
    }
  }
};

代码示例来源:origin: AsyncHttpClient/async-http-client

@Override
 public void operationComplete(ChannelFuture future) {
  operationComplete(future.channel(), future.cause());
 }
}

代码示例来源:origin: Graylog2/graylog2-server

@Override
  public void operationComplete(ChannelFuture future) throws Exception {
    if (!future.isSuccess()) {
      LOG.info("Write on channel {} failed", future.channel(), future.cause());
    }
  }
}

代码示例来源:origin: redisson/redisson

@Override
  public void operationComplete(ChannelFuture future) throws Exception {
    if (!future.isSuccess()) {
      forceClose(child, future.cause());
    }
  }
});

代码示例来源:origin: alibaba/Sentinel

@Override
  public void operationComplete(ChannelFuture future) {
    if (future.cause() != null) {
      RecordLog.warn(
        String.format("[NettyTransportClient] Could not connect to <%s:%d> after %d times",
          host, port, failConnectedTime.get()), future.cause());
      failConnectedTime.incrementAndGet();
      channel = null;
    } else {
      failConnectedTime.set(0);
      channel = future.channel();
      RecordLog.info(
        "[NettyTransportClient] Successfully connect to server <" + host + ":" + port + ">");
    }
  }
});

代码示例来源:origin: redisson/redisson

@Override
  public void operationComplete(ChannelFuture future) {
    if (!future.isSuccess()) {
      future.channel().pipeline().fireExceptionCaught(future.cause());
    }
  }
};

代码示例来源:origin: wildfly/wildfly

@Override
  public void operationComplete(ChannelFuture future) throws Exception {
    if (!future.isSuccess()) {
      forceClose(child, future.cause());
    }
  }
});

代码示例来源:origin: netty/netty

private ChannelFuture doBind(final SocketAddress localAddress) {
  final ChannelFuture regFuture = initAndRegister();
  final Channel channel = regFuture.channel();
  if (regFuture.cause() != null) {
    return regFuture;

代码示例来源:origin: jamesdbloom/mockserver

@Override
  public void operationComplete(ChannelFuture future) {
    if (future.isSuccess()) {
      // send the HTTP request
      future.channel().writeAndFlush(httpRequest);
    } else {
      httpResponseSettableFuture.setException(future.cause());
    }
  }
});

代码示例来源:origin: wildfly/wildfly

@Override
  public void operationComplete(ChannelFuture future) throws Exception {
    if (!future.isSuccess()) {
      setConnectFailure(future.cause());
    }
  }
};

代码示例来源:origin: redisson/redisson

private ChannelFuture doBind(final SocketAddress localAddress) {
  final ChannelFuture regFuture = initAndRegister();
  final Channel channel = regFuture.channel();
  if (regFuture.cause() != null) {
    return regFuture;

代码示例来源:origin: normanmaurer/netty-in-action

@Override
  public void operationComplete(ChannelFuture f) {
    if (!f.isSuccess()) {
      f.cause().printStackTrace();
      f.channel().close();
    }
  }
});

代码示例来源:origin: eclipse-vertx/vert.x

private void notifyHandler(ChannelFuture future) {
  if (future.isSuccess()) {
   handler.handle(Future.succeededFuture(result));
  } else {
   handler.handle(Future.failedFuture(future.cause()));
  }
 }
}

代码示例来源:origin: apache/pulsar

/**
 * Attempt to establish a TCP connection to an already resolved single IP address
 */
private CompletableFuture<Channel> connectToAddress(InetAddress ipAddress, int port) {
  CompletableFuture<Channel> future = new CompletableFuture<>();
  bootstrap.connect(ipAddress, port).addListener((ChannelFuture channelFuture) -> {
    if (channelFuture.isSuccess()) {
      future.complete(channelFuture.channel());
    } else {
      future.completeExceptionally(channelFuture.cause());
    }
  });
  return future;
}

代码示例来源:origin: netty/netty

@Override
  public void operationComplete(ChannelFuture future) throws Exception {
    if (!future.isSuccess()) {
      ctx.fireExceptionCaught(future.cause());
    }
  }
};

代码示例来源:origin: normanmaurer/netty-in-action

@Override
  public void operationComplete(io.netty.channel.ChannelFuture f) {
    if (!f.isSuccess()) {
      f.cause().printStackTrace();
      f.channel().close();
    }
  }
});

代码示例来源:origin: netty/netty

private void recordException(ChannelFuture future) {
  if (!future.isSuccess()) {
    recordException(future.cause());
  }
}

代码示例来源:origin: relayrides/pushy

@Override
  public void operationComplete(final ChannelFuture future) {
    if (!future.isSuccess()) {
      log.debug("Failed to write PING frame.", future.cause());
      future.channel().close();
    }
  }
});

代码示例来源:origin: mpusher/mpush

@Override
public void operationComplete(ChannelFuture future) throws Exception {
  if (future.isSuccess()) {
    lastWriteTime = System.currentTimeMillis();
  } else {
    LOGGER.error("connection send msg error", future.cause());
    Logs.CONN.error("connection send msg error={}, conn={}", future.cause().getMessage(), this);
  }
}

相关文章