OioClientSocketChannel( ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) { super(null, factory, pipeline, sink, new Socket()); fireChannelOpen(this); }
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); } }
DefaultLocalServerChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) { super(factory, pipeline, sink); channelConfig = new DefaultServerChannelConfig(); fireChannelOpen(this); }
NioClientSocketChannel( ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, NioWorker worker) { super(null, factory, pipeline, sink, newSocket(), worker); fireChannelOpen(this); } }
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); }
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()); }
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); }
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); }
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); }
private void fireInitialEvents() { // Fire the typical initial events. fireChannelOpen(channel); fireChannelBound(channel, channel.getLocalAddress()); fireChannelConnected(channel, channel.getRemoteAddress()); }
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); }
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); }
AgronaClientChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, AgronaClientBoss boss, AgronaWorker worker) { super(null, factory, pipeline, sink, worker); this.boss = boss; fireChannelOpen(this); }
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); } }
HttpClientChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) { super(null, factory, pipeline, sink, new DefaultHttpChannelConfig()); this.writeState = HttpWriteState.REQUEST; fireChannelOpen(this); }
AgronaChildChannel(AgronaServerChannel parent, ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink, AgronaWorker worker) { super(parent, factory, pipeline, sink, worker); setConnected(); fireChannelOpen(this); }
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); }
TlsClientChannel(ChannelFactory factory, ChannelPipeline pipeline, ChannelSink sink) { super(null, factory, pipeline, sink, new DefaultTlsChannelConfig()); fireChannelOpen(this); }
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); }
private void fireInitialEvents() { // Fire the typical initial events. fireChannelOpen( channel ); fireChannelBound( channel, channel.getLocalAddress() ); fireChannelConnected( channel, channel.getRemoteAddress() ); }