@Override protected void doStart() throws Exception { _shutdown.cancel(); if(_defaultProtocol==null) throw new IllegalStateException("No default protocol for "+this); _defaultConnectionFactory = getConnectionFactory(_defaultProtocol); if(_defaultConnectionFactory==null) throw new IllegalStateException("No protocol factory for default protocol '"+_defaultProtocol+"' in "+this); SslConnectionFactory ssl = getConnectionFactory(SslConnectionFactory.class); if (ssl != null) { String next = ssl.getNextProtocol(); ConnectionFactory cf = getConnectionFactory(next); if (cf == null) throw new IllegalStateException("No protocol factory for SSL next protocol: '" + next + "' in " + this); } _lease = ThreadPoolBudget.leaseFrom(getExecutor(),this,_acceptors.length); super.doStart(); _stopping=new CountDownLatch(_acceptors.length); for (int i = 0; i < _acceptors.length; i++) { Acceptor a = new Acceptor(i); addBean(a); getExecutor().execute(a); } LOG.info("Started {}", this); }
if (handler!=null && !_shutdown.isShutdown() && isStarted()) handler.handle(path, baseRequest, request, response); else FutureCallback shutdown = _shutdown.get(); if (shutdown!=null)
@Override public void onComplete(AsyncEvent event) throws IOException { HttpChannelState state = ((AsyncContextEvent)event).getHttpChannelState(); Request request = state.getBaseRequest(); final long elapsed = System.currentTimeMillis()-request.getTimeStamp(); long d=_requestStats.decrement(); _requestTimeStats.record(elapsed); updateResponse(request); _asyncWaitStats.decrement(); // If we have no more dispatches, should we signal shutdown? if (d==0) { FutureCallback shutdown = _shutdown.get(); if (shutdown!=null) shutdown.succeeded(); } } };
@Override protected void doStart() throws Exception { _shutdown.cancel(); super.doStart(); statsReset(); }
@Override public Future<Void> shutdown() { return _shutdown.shutdown(); }
@Override public Future<Void> shutdown() { return _shutdown.shutdown(); }
@Override public boolean isShutdown() { return _shutdown.isShutdown(); }
@Override protected void doStop() throws Exception { _shutdown.cancel(); super.doStop(); }
@Override public Future<Void> shutdown() { return _shutdown.updateAndGet(fcb->{return fcb==null?newShutdownCallback():fcb;}); }
@Override public boolean isShutdown() { return _shutdown.isShutdown(); }
@Override public Future<Void> shutdown() { return _shutdown.updateAndGet(fcb->{return fcb==null?newShutdownCallback():fcb;}); }