org.jboss.netty.channel.Channels.fireChannelClosed()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(6.1k)|赞(0)|评价(0)|浏览(156)

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

Channels.fireChannelClosed介绍

[英]Sends a "channelClosed" event to the first ChannelUpstreamHandler in the ChannelPipeline of the specified Channel.
[中]将“channelClosed”事件发送到指定通道的ChannelPipeline中的第一个ChannelUpstreamHandler。

代码示例

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

@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
    throws Exception {
  fireChannelClosed(virtualChannel);
}

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

fireChannelClosed(channel);
} else {
  fireChannelClosedLater(channel);

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

public void run() {
    fireChannelClosed(channel);
  }
});

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

fireChannelClosed(channel);
} else {
  fireChannelClosedLater(channel);

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

public boolean finish() {
  close(channel);
  fireChannelDisconnected(channel);
  fireChannelUnbound(channel);
  fireChannelClosed(channel);
  return !productQueue.isEmpty();
}

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

private static void close(OioServerSocketChannel channel, ChannelFuture future) {
  boolean bound = channel.isBound();
  try {
    channel.socket.close();
    // Make sure the boss thread is not running so that that the future
    // is notified after a new connection cannot be accepted anymore.
    // See NETTY-256 for more information.
    channel.shutdownLock.lock();
    try {
      if (channel.setClosed()) {
        future.setSuccess();
        if (bound) {
          fireChannelUnbound(channel);
        }
        fireChannelClosed(channel);
      } else {
        future.setSuccess();
      }
    } finally {
      channel.shutdownLock.unlock();
    }
  } catch (Throwable t) {
    future.setFailure(t);
    fireExceptionCaught(channel, t);
  }
}

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

private static void close(DefaultLocalServerChannel channel, ChannelFuture future) {
    try {
      if (channel.setClosed()) {
        future.setSuccess();
        LocalAddress localAddress = channel.localAddress;
        if (channel.bound.compareAndSet(true, false)) {
          channel.localAddress = null;
          LocalChannelRegistry.unregister(localAddress);
          fireChannelUnbound(channel);
        }
        fireChannelClosed(channel);
      } else {
        future.setSuccess();
      }
    } catch (Throwable t) {
      future.setFailure(t);
      fireExceptionCaught(channel, t);
    }
  }
}

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

fireChannelUnbound(this);
  fireChannelClosed(this);
    fireChannelUnbound(pairedChannel);
  fireChannelClosed(pairedChannel);
} finally {
  future.setSuccess();

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

void close(NioServerSocketChannel channel, ChannelFuture future) {
  boolean bound = channel.isBound();
  try {
    channel.socket.close();
    increaseCancelledKeys();
    if (channel.setClosed()) {
      future.setSuccess();
      if (bound) {
        fireChannelUnbound(channel);
      }
      fireChannelClosed(channel);
    } else {
      future.setSuccess();
    }
  } catch (Throwable t) {
    future.setFailure(t);
    fireExceptionCaught(channel, t);
  }
}

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

private static void close(NioDatagramChannel channel, ChannelFuture future) {
  try {
    channel.getDatagramChannel().socket().close();
    if (channel.setClosed()) {
      future.setSuccess();
      if (channel.isBound()) {
        fireChannelUnbound(channel);
      }
      fireChannelClosed(channel);
    } else {
      future.setSuccess();
    }
  } catch (final Throwable t) {
    future.setFailure(t);
    fireExceptionCaught(channel, t);
  }
}

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

@Override
public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
  TlsChildChannel tlsChildChannel = this.tlsChildChannel;
  if (tlsChildChannel != null) {
    this.tlsChildChannel = null;
    if (tlsChildChannel.setReadClosed()) {
      fireChannelDisconnected(tlsChildChannel);
      fireChannelUnbound(tlsChildChannel);
      fireChannelClosed(tlsChildChannel);
    }
  }
}

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

@Override
  public void operationComplete(ChannelFuture future) throws Exception {
    if (tlsClientChannel.setWriteClosed()) {
      fireChannelDisconnected(tlsClientChannel);
      fireChannelUnbound(tlsClientChannel);
      fireChannelClosed(tlsClientChannel);
    }
  }
};

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

@Override
  public void operationComplete(ChannelFuture future) throws Exception {
    if (tlsChildChannel.setWriteClosed()) {
      fireChannelDisconnected(tlsChildChannel);
      fireChannelUnbound(tlsChildChannel);
      fireChannelClosed(tlsChildChannel);
    }
  }
};

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

@Override
  public void operationComplete(ChannelFuture future) throws Exception {
    if (httpChildChannel.setWriteClosed()) {
      fireChannelDisconnected(httpChildChannel);
      fireChannelUnbound(httpChildChannel);
      fireChannelClosed(httpChildChannel);
    }
  }
});

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

@Override
  public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception {
    TlsClientChannel tlsClientChannel = this.tlsClientChannel;
    if (tlsClientChannel != null) {

      this.tlsClientChannel = null;

      if (tlsClientChannel.setReadClosed()) {
        fireChannelDisconnected(tlsClientChannel);
        fireChannelUnbound(tlsClientChannel);
        fireChannelClosed(tlsClientChannel);
      }
    }
  }
}

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

private static void handleBBoshTransportCloseComplete(
    BBoshServerChannel bboshCloseChannel,
    ChannelFuture bboshCloseFuture,
    ChannelFuture closeFuture) {
  if (closeFuture.isSuccess()) {
    fireChannelClosed(bboshCloseChannel);
    bboshCloseFuture.setSuccess();
  }
  else {
    bboshCloseFuture.setFailure(closeFuture.getCause());
  }
}

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

@Override
public void run() {
  serverChannel.setClosed();
  fireChannelUnbound(serverChannel);
  fireChannelClosed(serverChannel);
  serverChannel.getCloseFuture().setSuccess();
}

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

private static void handleTlsTransportCloseComplete(
    TlsServerChannel tlsCloseChannel,
    ChannelFuture tlsCloseFuture,
    ChannelFuture closeFuture) {
  if (closeFuture.isSuccess()) {
    fireChannelClosed(tlsCloseChannel);
    tlsCloseChannel.setClosed();
  }
  else {
    tlsCloseFuture.setFailure(closeFuture.getCause());
  }
}

代码示例来源:origin: projectodd/stilts

public boolean finish() {
  fireChannelDisconnected( channel );
  fireChannelUnbound( channel );
  fireChannelClosed( channel );
  return !productQueue.isEmpty();
}

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

@Override
protected void closeRequested(ChannelPipeline pipeline, ChannelStateEvent evt) throws Exception {
  UdpServerChannel serverChannel = (UdpServerChannel) evt.getChannel();
  // Close underlying NioDatagramChannel
  serverChannel.getTransport().close();
  // setClosed() (but *not* evt.getFuture().setSuccess()) triggers the ChannelFuture's success
  serverChannel.setClosed();
  fireChannelDisconnected(serverChannel);
  fireChannelUnbound(serverChannel);
  fireChannelClosed(serverChannel);
}

相关文章