本文整理了Java中org.jboss.netty.channel.Channels.fireChannelBound()
方法的一些代码示例,展示了Channels.fireChannelBound()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Channels.fireChannelBound()
方法的具体详情如下:
包路径:org.jboss.netty.channel.Channels
类名称:Channels
方法名:fireChannelBound
[英]Sends a "channelBound" event to the first ChannelUpstreamHandler in the ChannelPipeline of the specified Channel.
[中]将“channelBound”事件发送到指定通道的ChannelPipeline中的第一个ChannelUpstreamHandler。
代码示例来源:origin: io.netty/netty
@Override
public void channelBound(ChannelHandlerContext ctx, ChannelStateEvent e)
throws Exception {
fireChannelBound(virtualChannel, (SocketAddress) e.getValue());
}
代码示例来源:origin: io.netty/netty
private static void bind(
OioClientSocketChannel channel, ChannelFuture future,
SocketAddress localAddress) {
try {
channel.socket.bind(localAddress);
future.setSuccess();
fireChannelBound(channel, channel.getLocalAddress());
} catch (Throwable t) {
future.setFailure(t);
fireExceptionCaught(channel, t);
}
}
代码示例来源: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
private static void bind(
NioClientSocketChannel channel, ChannelFuture future,
SocketAddress localAddress) {
try {
channel.channel.socket().bind(localAddress);
channel.boundManually = true;
channel.setBound();
future.setSuccess();
fireChannelBound(channel, channel.getLocalAddress());
} catch (Throwable t) {
future.setFailure(t);
fireExceptionCaught(channel, t);
}
}
代码示例来源: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
public void run() {
boolean bound = false;
boolean registered = false;
try {
channel.socket.socket().bind(localAddress, channel.getConfig().getBacklog());
bound = true;
future.setSuccess();
fireChannelBound(channel, channel.getLocalAddress());
channel.socket.register(selector, SelectionKey.OP_ACCEPT, channel);
registered = true;
} catch (Throwable t) {
future.setFailure(t);
fireExceptionCaught(channel, t);
} finally {
if (!registered && bound) {
close(channel, future);
}
}
}
}
代码示例来源:origin: io.netty/netty
private static void bind(DefaultLocalServerChannel channel, ChannelFuture future, LocalAddress localAddress) {
try {
if (!LocalChannelRegistry.register(localAddress, channel)) {
throw new ChannelException("address already in use: " + localAddress);
}
if (!channel.bound.compareAndSet(false, true)) {
throw new ChannelException("already bound");
}
channel.localAddress = localAddress;
future.setSuccess();
fireChannelBound(channel, localAddress);
} catch (Throwable t) {
LocalChannelRegistry.unregister(localAddress);
future.setFailure(t);
fireExceptionCaught(channel, t);
}
}
代码示例来源:origin: io.netty/netty
fireChannelBound(channel, channel.getLocalAddress());
代码示例来源:origin: io.netty/netty
private static void bind(DefaultLocalChannel channel, ChannelFuture future, LocalAddress localAddress) {
try {
if (!LocalChannelRegistry.register(localAddress, channel)) {
throw new ChannelException("address already in use: " + localAddress);
}
channel.setBound();
channel.localAddress = localAddress;
future.setSuccess();
fireChannelBound(channel, localAddress);
} catch (Throwable t) {
LocalChannelRegistry.unregister(localAddress);
future.setFailure(t);
fireExceptionCaught(channel, t);
}
}
代码示例来源:origin: io.netty/netty
fireChannelBound(channel, localAddress);
代码示例来源:origin: io.netty/netty
/**
* Will bind the DatagramSocket to the passed-in address.
* Every call bind will spawn a new thread using the that basically in turn
*/
private static void bind(final NioDatagramChannel channel,
final ChannelFuture future, final InetSocketAddress address) {
boolean bound = false;
boolean started = false;
try {
// First bind the DatagramSocket the specified port.
channel.getDatagramChannel().socket().bind(address);
bound = true;
future.setSuccess();
fireChannelBound(channel, address);
channel.worker.register(channel, null);
started = true;
} catch (final Throwable t) {
future.setFailure(t);
fireExceptionCaught(channel, t);
} finally {
if (!started && bound) {
close(channel, future);
}
}
}
代码示例来源:origin: io.netty/netty
private void bind(
OioServerSocketChannel channel, ChannelFuture future,
SocketAddress localAddress) {
boolean bound = false;
boolean bossStarted = false;
try {
channel.socket.bind(localAddress, channel.getConfig().getBacklog());
bound = true;
future.setSuccess();
localAddress = channel.getLocalAddress();
fireChannelBound(channel, localAddress);
Executor bossExecutor =
((OioServerSocketChannelFactory) channel.getFactory()).bossExecutor;
DeadLockProofWorker.start(
bossExecutor,
new ThreadRenamingRunnable(
new Boss(channel),
"Old I/O server boss (" + channel + ')',
determiner));
bossStarted = true;
} catch (Throwable t) {
future.setFailure(t);
fireExceptionCaught(channel, t);
} finally {
if (!bossStarted && bound) {
close(channel, future);
}
}
}
代码示例来源:origin: io.netty/netty
private void bind(
OioDatagramChannel channel, ChannelFuture future,
SocketAddress localAddress) {
boolean bound = false;
boolean workerStarted = false;
try {
channel.socket.bind(localAddress);
bound = true;
// Fire events
future.setSuccess();
fireChannelBound(channel, channel.getLocalAddress());
// Start the business.
DeadLockProofWorker.start(
workerExecutor,
new ThreadRenamingRunnable(
new OioDatagramWorker(channel),
"Old I/O datagram worker (" + channel + ')',
determiner));
workerStarted = true;
} catch (Throwable t) {
future.setFailure(t);
fireExceptionCaught(channel, t);
} finally {
if (bound && !workerStarted) {
AbstractOioWorker.close(channel, future);
}
}
}
代码示例来源:origin: io.netty/netty
fireChannelBound(channel, channel.getLocalAddress());
代码示例来源:origin: io.netty/netty
fireChannelBound(channel, channel.getLocalAddress());
代码示例来源:origin: io.netty/netty
throw new Error(e);
fireChannelBound(acceptedChannel, channel.getRemoteAddress());
acceptedChannel.remoteAddress = channel.getLocalAddress();
acceptedChannel.setConnected();
代码示例来源:origin: k3po/k3po
@Override
protected void bindRequested(ChannelPipeline pipeline, ChannelStateEvent evt) throws Exception {
ChannelFuture httpBindFuture = evt.getFuture();
HttpClientChannel httpConnectChannel = (HttpClientChannel) evt.getChannel();
ChannelAddress httpLocalAddress = (ChannelAddress) evt.getValue();
httpConnectChannel.setLocalAddress(httpLocalAddress);
httpConnectChannel.setBound();
fireChannelBound(httpConnectChannel, httpLocalAddress);
httpBindFuture.setSuccess();
}
代码示例来源:origin: k3po/k3po
@Override
protected void bindRequested(ChannelPipeline pipeline, ChannelStateEvent evt) throws Exception {
ChannelFuture tlsBindFuture = evt.getFuture();
TlsClientChannel tlsConnectChannel = (TlsClientChannel) evt.getChannel();
ChannelAddress tlsLocalAddress = (ChannelAddress) evt.getValue();
tlsConnectChannel.setLocalAddress(tlsLocalAddress);
tlsConnectChannel.setBound();
fireChannelBound(tlsConnectChannel, tlsLocalAddress);
tlsBindFuture.setSuccess();
}
代码示例来源:origin: k3po/k3po
@Override
protected void connectRequested(ChannelPipeline pipeline, ChannelStateEvent evt) throws Exception {
AgronaClientChannel channel = (AgronaClientChannel) evt.getChannel();
AgronaChannelAddress remoteAddress = (AgronaChannelAddress) evt.getValue();
if (!channel.isBound()) {
ChannelAddress localAddress = remoteAddress;
channel.setLocalAddress(localAddress);
channel.setBound();
fireChannelBound(channel, localAddress);
}
ChannelFuture future = evt.getFuture();
channel.boss.connect(channel, remoteAddress, future);
}
代码示例来源:origin: projectodd/stilts
private void fireInitialEvents() {
// Fire the typical initial events.
fireChannelOpen( channel );
fireChannelBound( channel, channel.getLocalAddress() );
fireChannelConnected( channel, channel.getRemoteAddress() );
}
内容来源于网络,如有侵权,请联系作者删除!