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

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

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

Channels.fireChannelOpen介绍

[英]Sends a "channelOpen" event to the first ChannelUpstreamHandler in the ChannelPipeline of the specified Channel. If the specified channel has a parent, a "childChannelOpen" event will be sent, too.
[中]将“channelOpen”事件发送到指定通道的ChannelPipeline中的第一个ChannelUpstreamHandler。如果指定的通道具有父通道,则也将发送“childChannelOpen”事件。

代码示例

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

OioClientSocketChannel(
    ChannelFactory factory,
    ChannelPipeline pipeline,
    ChannelSink sink) {
  super(null, factory, pipeline, sink, new Socket());
  fireChannelOpen(this);
}

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

NioAcceptedSocketChannel(
      ChannelFactory factory, ChannelPipeline pipeline,
      Channel parent, ChannelSink sink,
      SocketChannel socket, NioWorker worker, Thread bossThread) {

    super(parent, factory, pipeline, sink, socket, worker);

    this.bossThread = bossThread;

    setConnected();

    fireChannelOpen(this);
  }
}

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

DefaultLocalServerChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) {
  super(factory, pipeline, sink);
  channelConfig = new DefaultServerChannelConfig();
  fireChannelOpen(this);
}

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

NioClientSocketChannel(
      ChannelFactory factory, ChannelPipeline pipeline,
      ChannelSink sink, NioWorker worker) {

    super(null, factory, pipeline, sink, newSocket(), worker);
    fireChannelOpen(this);
  }
}

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

NioDatagramChannel(final ChannelFactory factory,
    final ChannelPipeline pipeline, final ChannelSink sink,
    final NioDatagramWorker worker, InternetProtocolFamily family) {
  super(null, factory, pipeline, sink, worker, openNonBlockingChannel(family));
  config = new DefaultNioDatagramChannelConfig(channel);
  fireChannelOpen(this);
}

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

OioAcceptedSocketChannel(
    Channel parent,
    ChannelFactory factory,
    ChannelPipeline pipeline,
    ChannelSink sink,
    Socket socket) {
  super(parent, factory, pipeline, sink, socket);
  try {
    in = new PushbackInputStream(socket.getInputStream(), 1);
  } catch (IOException e) {
    throw new ChannelException("Failed to obtain an InputStream.", e);
  }
  try {
    out = socket.getOutputStream();
  } catch (IOException e) {
    throw new ChannelException("Failed to obtain an OutputStream.", e);
  }
  fireChannelOpen(this);
  fireChannelBound(this, getLocalAddress());
}

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

DefaultLocalChannel(
    LocalServerChannel parent, ChannelFactory factory, ChannelPipeline pipeline,
    ChannelSink sink, DefaultLocalChannel pairedChannel) {
  super(parent, factory, pipeline, sink);
  this.pairedChannel = pairedChannel;
  config = new DefaultChannelConfig();
  // TODO Move the state variable to AbstractChannel so that we don't need
  //      to add many listeners.
  getCloseFuture().addListener(new ChannelFutureListener() {
    public void operationComplete(ChannelFuture future) throws Exception {
      state.set(ST_CLOSED);
    }
  });
  fireChannelOpen(this);
}

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

NioServerSocketChannel(
    ChannelFactory factory,
    ChannelPipeline pipeline,
    ChannelSink sink, Boss boss, WorkerPool<NioWorker> workerPool) {
  super(factory, pipeline, sink);
  this.boss = boss;
  this.workerPool = workerPool;
  try {
    socket = ServerSocketChannel.open();
  } catch (IOException e) {
    throw new ChannelException(
        "Failed to open a server socket.", e);
  }
  try {
    socket.configureBlocking(false);
  } catch (IOException e) {
    try {
      socket.close();
    } catch (IOException e2) {
      if (logger.isWarnEnabled()) {
        logger.warn(
            "Failed to close a partially initialized socket.", e2);
      }
    }
    throw new ChannelException("Failed to enter non-blocking mode.", e);
  }
  config = new DefaultServerSocketChannelConfig(socket.socket());
  fireChannelOpen(this);
}

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

OioServerSocketChannel(
    ChannelFactory factory,
    ChannelPipeline pipeline,
    ChannelSink sink) {
  super(factory, pipeline, sink);
  try {
    socket = new ServerSocket();
  } catch (IOException e) {
    throw new ChannelException(
        "Failed to open a server socket.", e);
  }
  try {
    socket.setSoTimeout(1000);
  } catch (IOException e) {
    try {
      socket.close();
    } catch (IOException e2) {
      if (logger.isWarnEnabled()) {
        logger.warn(
            "Failed to close a partially initialized socket.", e2);
      }
    }
    throw new ChannelException(
        "Failed to set the server socket timeout.", e);
  }
  config = new DefaultServerSocketChannelConfig(socket);
  fireChannelOpen(this);
}

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

private void fireInitialEvents() {
  // Fire the typical initial events.
  fireChannelOpen(channel);
  fireChannelBound(channel, channel.getLocalAddress());
  fireChannelConnected(channel, channel.getRemoteAddress());
}

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

OioDatagramChannel(
    ChannelFactory factory,
    ChannelPipeline pipeline,
    ChannelSink sink) {
  super(null, factory, pipeline, sink);
  try {
    socket = new MulticastSocket(null);
  } catch (IOException e) {
    throw new ChannelException("Failed to open a datagram socket.", e);
  }
  try {
    socket.setSoTimeout(10);
    socket.setBroadcast(false);
  } catch (SocketException e) {
    throw new ChannelException(
        "Failed to configure the datagram socket timeout.", e);
  }
  config = new DefaultDatagramChannelConfig(socket);
  fireChannelOpen(this);
}

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

HttpTunnelingClientSocketChannel(
    ChannelFactory factory,
    ChannelPipeline pipeline,
    ChannelSink sink, ClientSocketChannelFactory clientSocketChannelFactory) {
  super(null, factory, pipeline, sink);
  config = new HttpTunnelingSocketChannelConfig(this);
  DefaultChannelPipeline channelPipeline = new DefaultChannelPipeline();
  channelPipeline.addLast("decoder", new HttpResponseDecoder());
  channelPipeline.addLast("encoder", new HttpRequestEncoder());
  channelPipeline.addLast("handler", handler);
  realChannel = clientSocketChannelFactory.newChannel(channelPipeline);
  fireChannelOpen(this);
}

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

AgronaClientChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink,
    AgronaClientBoss boss, AgronaWorker worker) {
  super(null, factory, pipeline, sink, worker);
  this.boss = boss;
  fireChannelOpen(this);
}

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

protected AbstractServerChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, T config,
    boolean fireChannelOpen) {
  super(factory, pipeline, sink);
  this.config = config;
  this.bound = new AtomicBoolean();
  this.bindCount = new AtomicInteger();
  if (fireChannelOpen) {
    // required by ServerBootstrap
    fireChannelOpen(this);
  }
}

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

HttpClientChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) {
  super(null, factory, pipeline, sink, new DefaultHttpChannelConfig());
  this.writeState = HttpWriteState.REQUEST;
  fireChannelOpen(this);
}

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

AgronaChildChannel(AgronaServerChannel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink,
    AgronaWorker worker) {
  super(parent, factory, pipeline, sink, worker);
  setConnected();
  fireChannelOpen(this);
}

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

AgronaServerChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink,
    AgronaServerBoss boss, AgronaWorker worker) {
  super(factory, pipeline, sink, new DefaultAgronaServerChannelConfig(), false);
  this.boss = boss;
  this.worker = worker;
  fireChannelOpen(this);
}

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

TlsClientChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) {
  super(null, factory, pipeline, sink, new DefaultTlsChannelConfig());
  fireChannelOpen(this);
}

代码示例来源:origin: kaazing/gateway

NioDatagramChannel(final ChannelFactory factory,
    final ChannelPipeline pipeline, final ChannelSink sink,
    final AbstractNioWorker worker, InternetProtocolFamily family) {
  super(null, factory, pipeline, sink, worker, openNonBlockingChannel(family), true);
  config = new DefaultNioDatagramChannelConfig(channel);
  fireChannelOpen(this);
}

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

private void fireInitialEvents() {
  // Fire the typical initial events.
  fireChannelOpen( channel );
  fireChannelBound( channel, channel.getLocalAddress() );
  fireChannelConnected( channel, channel.getRemoteAddress() );
}

相关文章