@Override protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, SelectionKey key) throws IOException { SelectChannelEndPoint endp = new SelectChannelEndPoint(channel, selectSet, key, channel.socket().getSoTimeout()); endp.setConnection(selectSet.getManager().newConnection(channel,endp, key.attachment())); endp.setMaxIdleTime(_writeTimeout); return endp; }
@Override protected void endPointOpened(SelectChannelEndPoint endpoint) { // TODO handle max connections and low resources connectionOpened(endpoint.getConnection()); }
@Override protected void endPointOpened(SelectChannelEndPoint endpoint) { ProxyToServerConnection proxyToServer = (ProxyToServerConnection)endpoint.getSelectionKey().attachment(); proxyToServer.ready(); }
protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, SelectionKey key) throws IOException { SelectChannelEndPoint endp= new SelectChannelEndPoint(channel,selectSet,key, SelectChannelConnector.this._maxIdleTime); endp.setConnection(selectSet.getManager().newConnection(channel,endp, key.attachment())); return endp; }
try{close();} catch(IOException e2){LOG.ignore(e2);} try{close();} catch(IOException e2){LOG.ignore(e2);} try{close();} catch(IOException e2){LOG.ignore(e2);} if (!_ishut && isInputShutdown() && isOpen()) try{close();} catch(IOException e2){LOG.ignore(e2);} updateKey(); dispatched=!undispatch(); dispatched=!undispatch(); while (dispatched) dispatched=!undispatch();
ch=endpoint.getChannel(); endpoint.doUpdateKey(); SelectChannelEndPoint endpoint = createEndPoint((SocketChannel)channel,key); key.attach(endpoint); endpoint.schedule(); SelectChannelEndPoint endpoint = createEndPoint(channel,key); key.attach(endpoint); endpoint.schedule(); SelectChannelEndPoint endpoint = (SelectChannelEndPoint)key.attachment(); if (endpoint != null) endpoint.doUpdateKey(); continue; ((SelectChannelEndPoint)att).schedule(); SelectChannelEndPoint endpoint = createEndPoint(channel,key); key.attach(endpoint); endpoint.schedule(); key.attach(endpoint); if (key.isReadable()) endpoint.schedule();
if (getChannel().isOpen()) SelectableChannel sc = (SelectableChannel)getChannel(); if (sc.isRegistered()) updateKey(); _key=((SelectableChannel)getChannel()).register(_selectSet.getSelector(),_interestOps,this);
if (getChannel().isOpen())
@Override protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, final SelectionKey key) throws IOException { WebSocketClient.WebSocketFuture holder = (WebSocketClient.WebSocketFuture)key.attachment(); int maxIdleTime = holder.getMaxIdleTime(); if (maxIdleTime < 0) maxIdleTime = (int)getMaxIdleTime(); SelectChannelEndPoint result = new SelectChannelEndPoint(channel, selectSet, key, maxIdleTime); AsyncEndPoint endPoint = result; // Detect if it is SSL, and wrap the connection if so if ("wss".equals(holder.getURI().getScheme())) { SSLEngine sslEngine = newSslEngine(channel); SslConnection sslConnection = new SslConnection(sslEngine, endPoint); endPoint.setConnection(sslConnection); endPoint = sslConnection.getSslEndPoint(); } AsyncConnection connection = selectSet.getManager().newConnection(channel, endPoint, holder); endPoint.setConnection(connection); return result; }
public void asyncDispatch() { synchronized(this) { switch(_state) { case STATE_NEEDS_DISPATCH: case STATE_UNDISPATCHED: dispatch(); break; case STATE_DISPATCHED: case STATE_ASYNC: _state=STATE_ASYNC; break; } } }
public void run() { for (SelectChannelEndPoint endp:_endPoints.keySet()) { endp.checkIdleTimestamp(idle_now); } } public String toString() {return "Idle-"+super.toString();}
try{close();} catch(IOException e2){LOG.ignore(e2);} try{close();} catch(IOException e2){LOG.ignore(e2);} try{close();} catch(IOException e2){LOG.ignore(e2);} if (!_ishut && isInputShutdown() && isOpen()) try{close();} catch(IOException e2){LOG.ignore(e2);} updateKey(); dispatched=!undispatch(); dispatched=!undispatch(); while (dispatched) dispatched=!undispatch();
ch=endpoint.getChannel(); endpoint.doUpdateKey(); SelectChannelEndPoint endpoint = createEndPoint((SocketChannel)channel,key); key.attach(endpoint); endpoint.schedule(); SelectChannelEndPoint endpoint = createEndPoint(channel,key); key.attach(endpoint); endpoint.schedule(); SelectChannelEndPoint endpoint = (SelectChannelEndPoint)key.attachment(); if (endpoint != null) endpoint.doUpdateKey(); continue; ((SelectChannelEndPoint)att).schedule(); SelectChannelEndPoint endpoint = createEndPoint(channel,key); key.attach(endpoint); endpoint.schedule(); key.attach(endpoint); if (key.isReadable()) endpoint.schedule();
protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, SelectionKey key) throws IOException { SelectChannelEndPoint endp= new SelectChannelEndPoint(channel,selectSet,key, SelectChannelConnector.this._maxIdleTime); endp.setConnection(selectSet.getManager().newConnection(channel,endp, key.attachment())); return endp; }
if (getChannel().isOpen()) SelectableChannel sc = (SelectableChannel)getChannel(); if (sc.isRegistered()) updateKey(); _key=((SelectableChannel)getChannel()).register(_selectSet.getSelector(),_interestOps,this);
if (getChannel().isOpen())
@Override protected SelectChannelEndPoint newEndPoint(SocketChannel channel, SelectSet selectSet, final SelectionKey key) throws IOException { WebSocketClient.WebSocketFuture holder = (WebSocketClient.WebSocketFuture)key.attachment(); int maxIdleTime = holder.getMaxIdleTime(); if (maxIdleTime < 0) maxIdleTime = (int)getMaxIdleTime(); SelectChannelEndPoint result = new SelectChannelEndPoint(channel, selectSet, key, maxIdleTime); AsyncEndPoint endPoint = result; // Detect if it is SSL, and wrap the connection if so if ("wss".equals(holder.getURI().getScheme())) { SSLEngine sslEngine = newSslEngine(channel); SslConnection sslConnection = new SslConnection(sslEngine, endPoint); endPoint.setConnection(sslConnection); endPoint = sslConnection.getSslEndPoint(); } AsyncConnection connection = selectSet.getManager().newConnection(channel, endPoint, holder); endPoint.setConnection(connection); return result; }
public void asyncDispatch() { synchronized(this) { switch(_state) { case STATE_NEEDS_DISPATCH: case STATE_UNDISPATCHED: dispatch(); break; case STATE_DISPATCHED: case STATE_ASYNC: _state=STATE_ASYNC; break; } } }