@Override
  public Connection newConnection(Connector connector, EndPoint endPoint) {
    ServerSessionListener listener = newSessionListener(connector, endPoint);

    Generator generator = new Generator(connector.getByteBufferPool(), getMaxHeaderTableSize());
    HTTP2ServerSession session =
        new HTTP2ServerSession(
            connector.getScheduler(),
            endPoint,
            generator,
            listener,
            new HTTP2FlowControl(getInitialStreamWindow()));
    session.setMaxLocalStreams(getMaxConcurrentStreams());
    session.setMaxRemoteStreams(getMaxConcurrentStreams());
    long idleTimeout = endPoint.getIdleTimeout();
    if (idleTimeout > 0) idleTimeout /= 2;
    session.setStreamIdleTimeout(idleTimeout);

    Parser parser = newServerParser(connector.getByteBufferPool(), session);
    HTTP2Connection connection =
        new HTTP2ServerConnection(
            connector.getByteBufferPool(),
            connector.getExecutor(),
            endPoint,
            parser,
            session,
            getInputBufferSize(),
            listener);

    return configure(connection, connector, endPoint);
  }
Exemple #2
0
 private static void checkSufficientThreads(Connector connector, String name) {
   if (connector == null) {
     return;
   }
   Executor executor = connector.getExecutor();
   if (executor instanceof ThreadPool) {
     ThreadPool queuedThreadPool = (ThreadPool) executor;
     checkState(
         !queuedThreadPool.isLowOnThreads(),
         "insufficient threads configured for %s connector",
         name);
   }
 }
 private HTTPSession(short version, Connector connector) {
   super(
       version,
       connector.getByteBufferPool(),
       connector.getExecutor(),
       connector.getScheduler(),
       null,
       getEndPoint(),
       null,
       1,
       proxyEngineSelector,
       null,
       null);
 }