本文整理了Java中org.jboss.netty.channel.Channels.close()
方法的一些代码示例,展示了Channels.close()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channels.close()
方法的具体详情如下:
包路径:org.jboss.netty.channel.Channels
类名称:Channels
方法名:close
[英]Sends a "close" request to the last ChannelDownstreamHandler in the ChannelPipeline of the specified Channel.
[中]将“关闭”请求发送到指定通道的ChannelPipeline中的最后一个ChannelDownstreamHandler。
代码示例来源:origin: io.netty/netty
public ChannelFuture close() {
ChannelFuture returnedCloseFuture = Channels.close(this);
assert closeFuture == returnedCloseFuture;
return closeFuture;
}
代码示例来源:origin: io.netty/netty
public boolean finish() {
close(channel);
fireChannelDisconnected(channel);
fireChannelUnbound(channel);
fireChannelClosed(channel);
return !productQueue.isEmpty();
}
代码示例来源:origin: io.netty/netty
public void operationComplete(ChannelFuture sentGoAwayFuture) throws Exception {
if (!(sentGoAwayFuture.getCause() instanceof ClosedChannelException)) {
Channels.close(ctx, e.getFuture());
} else {
e.getFuture().setSuccess();
}
}
}
代码示例来源:origin: io.netty/netty
public void operationComplete(ChannelFuture closeNotifyFuture) throws Exception {
if (!(closeNotifyFuture.getCause() instanceof ClosedChannelException)) {
Channels.close(context, e.getFuture());
} else {
e.getFuture().setSuccess();
}
}
}
代码示例来源:origin: io.netty/netty
public void operationComplete(ChannelFuture future) throws Exception {
if (!future.isSuccess()) {
Throwable cause = future.getCause();
hsFuture.setFailure(cause);
fireExceptionCaught(ctx, cause);
if (closeOnSslException) {
Channels.close(ctx, future(channel));
}
}
}
});
代码示例来源:origin: io.netty/netty
/**
* Sends an SSL {@code close_notify} message to the specified channel and
* destroys the underlying {@link SSLEngine}.
*/
public ChannelFuture close() {
ChannelHandlerContext ctx = this.ctx;
Channel channel = ctx.getChannel();
try {
engine.closeOutbound();
return wrapNonAppData(ctx, channel);
} catch (SSLException e) {
fireExceptionCaught(ctx, e);
if (closeOnSslException) {
Channels.close(ctx, future(channel));
}
return failedFuture(channel, e);
}
}
代码示例来源:origin: io.netty/netty
Channels.close(ctx, succeededFuture(ctx.getChannel()));
代码示例来源:origin: io.netty/netty
Channels.close(ctx, future(channel));
fireExceptionCaught(ctx, exception);
if (closeOnSslException) {
Channels.close(ctx, future(channel));
代码示例来源:origin: io.netty/netty
private void setHandshakeFailure(Channel channel, SSLException cause) {
synchronized (handshakeLock) {
if (!handshaking) {
return;
}
handshaking = false;
handshaken = false;
if (handshakeFuture == null) {
handshakeFuture = future(channel);
}
// cancel the timeout now
cancelHandshakeTimeout();
// Release all resources such as internal buffers that SSLEngine
// is managing.
engine.closeOutbound();
try {
engine.closeInbound();
} catch (SSLException e) {
if (logger.isDebugEnabled()) {
logger.debug(
"SSLEngine.closeInbound() raised an exception after " +
"a handshake failure.", e);
}
}
}
handshakeFuture.setFailure(cause);
if (closeOnSslException) {
Channels.close(ctx, future(channel));
}
}
代码示例来源:origin: io.netty/netty
Channels.close(ctx, future(channel));
代码示例来源:origin: io.netty/netty
future.addListener(ChannelFutureListener.CLOSE);
} else {
Channels.close(e.getChannel());
代码示例来源:origin: kaazing/gateway
public ChannelFuture close() {
ChannelFuture returnedCloseFuture = Channels.close(this);
assert closeFuture == returnedCloseFuture;
return closeFuture;
}
代码示例来源:origin: org.hbase/asynchbase
@Override
public Object call(final Exception e) throws Exception {
LOG.info("helloRpc failed. Closing the channel:" + chan, e);
Channels.close(chan);
return e;
}
};
代码示例来源:origin: k3po/k3po
public static ChannelFuture shutdownOutputOrClose(Channel channel) {
if (channel instanceof AbstractChannel) {
return shutdownOutput(channel);
}
else {
return close(channel);
}
}
代码示例来源:origin: itisaid/Doris
/**
* 关闭当前连接。
*/
public void close() throws NetException {
if (null != channel) {
Channels.close(channel).awaitUninterruptibly(500);
isOpenned.set(false);
logger.error("close connection success:" + address);
}
}
代码示例来源:origin: k3po/k3po
@Override
protected void invokeCommand(ChannelHandlerContext ctx) throws Exception {
ChannelFuture handlerFuture = getHandlerFuture();
Channels.close(ctx, handlerFuture);
}
代码示例来源:origin: k3po/k3po
public static void shutdownOutputOrClose(ChannelHandlerContext ctx, ChannelFuture future) {
if (ctx.getChannel() instanceof AbstractChannel) {
shutdownOutput(ctx, future);
}
else {
close(ctx, future);
}
}
代码示例来源:origin: k3po/k3po
public static void abortOutputOrClose(ChannelHandlerContext ctx, ChannelFuture future) {
if (ctx.getChannel() instanceof AbstractChannel) {
abortOutput(ctx, future);
}
else {
close(ctx, future);
}
}
代码示例来源:origin: com.yahoo.omid/tso-server
@Override
public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e) {
if (e.getCause() instanceof ClosedChannelException) {
return;
}
LOG.warn("TSOHandler: Unexpected exception from downstream.", e.getCause());
Channels.close(e.getChannel());
}
代码示例来源:origin: itisaid/Doris
@Override
public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
activeChannels.add(e.getChannel());
if (logger.isDebugEnabled()) {
logger.debug("Open new connection : " + e.getChannel().getRemoteAddress());
}
// 如果连接数过大,停止响应新的连接请求
if (activeChannels.size() > networkModule.getMaxConnections()) {
Channels.close(e.getChannel());
logger.error("Too many connections has established.");
}
}
内容来源于网络,如有侵权,请联系作者删除!