Nio2Endpoint (Apache Tomcat 8.5.12 API Documentation)

org.apache.tomcat.util.net

## Class Nio2Endpoint

- java.lang.Object
- - org.apache.tomcat.util.net.AbstractEndpoint<S>
  - - org.apache.tomcat.util.net.AbstractJsseEndpoint<Nio2Channel>
    - - org.apache.tomcat.util.net.Nio2Endpoint

-     public class Nio2Endpoint
      extends AbstractJsseEndpoint<Nio2Channel>

  NIO2 endpoint.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `Nio2Endpoint.Acceptor` With NIO2, the main acceptor thread only initiates the initial accept but periodically checks that the connector is still accepting (if not it will attempt to start again).
    `static class` | `Nio2Endpoint.Nio2SocketWrapper`
    `static class` | `Nio2Endpoint.SendfileData` SendfileData class.
    `protected class` | `Nio2Endpoint.SocketProcessor` This class is the equivalent of the Worker, but will simply use in an external Executor thread pool.

    - ### Nested classes/interfaces inherited from class org.apache.tomcat.util.net.AbstractEndpoint

      `AbstractEndpoint.BindState, AbstractEndpoint.Handler<S>`

  - ### Field Summary

    - ### Fields inherited from class org.apache.tomcat.util.net.AbstractEndpoint

      `acceptors, acceptorThreadCount, acceptorThreadPriority, attributes, internalExecutor, negotiableProtocols, paused, processorCache, running, sm, socketProperties, sslHostConfigs, threadPriority`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Nio2Endpoint()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `bind()` Initialize the endpoint.
    `void` | `closeSocket(SocketWrapperBase<Nio2Channel> socket)`
    `protected AbstractEndpoint.Acceptor` | `createAcceptor()` Hook to allow Endpoints to provide a specific Acceptor implementation.
    `protected SocketProcessorBase<Nio2Channel>` | `createSocketProcessor(SocketWrapperBase<Nio2Channel> socketWrapper, SocketEvent event)`
    `static void` | `endInline()`
    `boolean` | `getDeferAccept()` Is deferAccept supported?
    `int` | `getKeepAliveCount()` Number of keep-alive sockets.
    `protected Log` | `getLog()`
    `int` | `getReadBufSize()`
    `protected NetworkChannel` | `getServerSocket()`
    `int` | `getWriteBufSize()`
    `static boolean` | `isInline()`
    `protected boolean` | `setSocketOptions(AsynchronousSocketChannel socket)` Process the specified connection.
    `void` | `setSocketProperties(SocketProperties socketProperties)`
    `void` | `shutdownExecutor()`
    `static void` | `startInline()`
    `void` | `startInternal()` Start the NIO2 endpoint, creating acceptor.
    `void` | `stopInternal()` Stop the endpoint.
    `void` | `unbind()` Deallocate NIO memory pools, and close server socket.

    - ### Methods inherited from class org.apache.tomcat.util.net.AbstractJsseEndpoint

      `createSSLContext, createSSLEngine, destroySsl, getLocalAddress, getSniParseLimit, getSslConfigType, getSslImplementation, getSslImplementationName, init, initialiseSsl, isAlpnSupported, releaseSSLContext, setSniParseLimit, setSslImplementationName`

    - ### Methods inherited from class org.apache.tomcat.util.net.AbstractEndpoint

      `addNegotiatedProtocol, addSslHostConfig, countDownConnection, countUpOrAwaitConnection, createExecutor, destroy, findSslHostConfigs, getAcceptorThreadCount, getAcceptorThreadPriority, getAddress, getAttribute, getBacklog, getBindOnInit, getConnectionCount, getCurrentThreadCount, getCurrentThreadsBusy, getDaemon, getDefaultSSLHostConfigName, getExecutor, getExecutorTerminationTimeoutMillis, getHandler, getKeepAliveTimeout, getLocalPort, getMaxConnections, getMaxHeaderCount, getMaxKeepAliveRequests, getMaxThreads, getMinSpareThreads, getName, getPort, getProperty, getSocketProperties, getSoLinger, getSoTimeout, getSSLHostConfig, getTcpNoDelay, getThreadPriority, getUseSendfile, handleExceptionWithDelay, hasNegotiableProtocols, initializeConnectionLatch, isPaused, isRunning, isSSLEnabled, pause, processSocket, releaseConnectionLatch, resume, setAcceptorThreadCount, setAcceptorThreadPriority, setAddress, setAttribute, setBacklog, setBindOnInit, setDaemon, setDefaultSSLHostConfigName, setExecutor, setExecutorTerminationTimeoutMillis, setHandler, setKeepAliveTimeout, setMaxConnections, setMaxHeaderCount, setMaxKeepAliveRequests, setMaxThreads, setMinSpareThreads, setName, setPort, setProperty, setSoLinger, setSoTimeout, setSSLEnabled, setTcpNoDelay, setThreadPriority, setUseSendfile, start, startAcceptorThreads, stop, unlockAccept`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### Nio2Endpoint

          public Nio2Endpoint()

  - ### Method Detail

    - #### setSocketProperties

          public void setSocketProperties(SocketProperties socketProperties)

    - #### getDeferAccept

          public boolean getDeferAccept()

      Is deferAccept supported?
      Specified by:
        `getDeferAccept` in class `AbstractEndpoint<Nio2Channel>`

    - #### getKeepAliveCount

          public int getKeepAliveCount()

      Number of keep-alive sockets.
      Returns:
        Always returns -1.

    - #### bind

          public void bind()
                    throws Exception

      Initialize the endpoint.
      Specified by:
        `bind` in class `AbstractEndpoint<Nio2Channel>`
      Throws:
        `Exception`

    - #### startInternal

          public void startInternal()
                             throws Exception

      Start the NIO2 endpoint, creating acceptor.
      Specified by:
        `startInternal` in class `AbstractEndpoint<Nio2Channel>`
      Throws:
        `Exception`

    - #### stopInternal

          public void stopInternal()

      Stop the endpoint. This will cause all processing threads to stop.
      Specified by:
        `stopInternal` in class `AbstractEndpoint<Nio2Channel>`

    - #### unbind

          public void unbind()
                      throws Exception

      Deallocate NIO memory pools, and close server socket.
      Overrides:
        `unbind` in class `AbstractJsseEndpoint<Nio2Channel>`
      Throws:
        `Exception`

    - #### shutdownExecutor

          public void shutdownExecutor()

      Overrides:
        `shutdownExecutor` in class `AbstractEndpoint<Nio2Channel>`

    - #### getWriteBufSize

          public int getWriteBufSize()

    - #### getReadBufSize

          public int getReadBufSize()

    - #### createAcceptor

          protected AbstractEndpoint.Acceptor createAcceptor()

      Description copied from class: `AbstractEndpoint`
      Hook to allow Endpoints to provide a specific Acceptor implementation.
      Specified by:
        `createAcceptor` in class `AbstractEndpoint<Nio2Channel>`
      Returns:
        the acceptor

    - #### setSocketOptions

          protected boolean setSocketOptions(AsynchronousSocketChannel socket)

      Process the specified connection.
      Parameters:
        `socket` - The socket channel
      Returns:
        `true` if the socket was correctly configured and processing may continue, `false` if the socket needs to be close immediately

    - #### createSocketProcessor

          protected SocketProcessorBase<Nio2Channel> createSocketProcessor(SocketWrapperBase<Nio2Channel> socketWrapper,
                                                               SocketEvent event)

      Specified by:
        `createSocketProcessor` in class `AbstractEndpoint<Nio2Channel>`

    - #### closeSocket

          public void closeSocket(SocketWrapperBase<Nio2Channel> socket)

    - #### getLog

          protected Log getLog()

      Specified by:
        `getLog` in class `AbstractEndpoint<Nio2Channel>`

    - #### getServerSocket

          protected NetworkChannel getServerSocket()

      Specified by:
        `getServerSocket` in class `AbstractJsseEndpoint<Nio2Channel>`

    - #### startInline

          public static void startInline()

    - #### endInline

          public static void endInline()

    - #### isInline

          public static boolean isInline()

Copyright © 2000-2017 Apache Software Foundation. All Rights Reserved.