@Override public void channelBound(ChannelHandlerContext ctx, ChannelStateEvent e) throws Exception { fireChannelBound(virtualChannel, (SocketAddress) e.getValue()); }
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); } }
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()); }
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); } }
private void fireInitialEvents() { // Fire the typical initial events. fireChannelOpen(channel); fireChannelBound(channel, channel.getLocalAddress()); fireChannelConnected(channel, channel.getRemoteAddress()); }
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); } } } }
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); } }
fireChannelBound(channel, channel.getLocalAddress());
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); } }
fireChannelBound(channel, localAddress);
/** * 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); } } }
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); } } }
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); } } }
fireChannelBound(channel, channel.getLocalAddress());
fireChannelBound(channel, channel.getLocalAddress());
throw new Error(e); fireChannelBound(acceptedChannel, channel.getRemoteAddress()); acceptedChannel.remoteAddress = channel.getLocalAddress(); acceptedChannel.setConnected();
@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(); }
@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(); }
@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); }
private void fireInitialEvents() { // Fire the typical initial events. fireChannelOpen( channel ); fireChannelBound( channel, channel.getLocalAddress() ); fireChannelConnected( channel, channel.getRemoteAddress() ); }