Package org.apache.synapse.transport.nhttp

## Class HttpCoreNIOListener

- java.lang.Object
- - org.apache.synapse.transport.nhttp.HttpCoreNIOListener

- All Implemented Interfaces:
    `org.apache.axis2.transport.base.ManagementSupport`, `org.apache.axis2.transport.TransportListener`
  Direct Known Subclasses:
    `HttpCoreNIOMultiSSLListener`, `HttpCoreNIOSSLListener`

      public class HttpCoreNIOListener
      extends Object
      implements org.apache.axis2.transport.TransportListener, org.apache.axis2.transport.base.ManagementSupport

  NIO transport listener for Axis2 based on HttpCore and NIO extensions

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `static long` | `ACTIVE_CONNECTION_MONITOR_DELAY` | Delay for ActiveConnectionMonitor

    - ### Fields inherited from interface org.apache.axis2.transport.TransportListener

      `HOST_ADDRESS, PARAM_PORT`

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `HttpCoreNIOListener()` |

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `destroy()` |
    `int` | `getActiveConnectionsSize()` |
    `int` | `getActiveThreadCount()` | Returns the number of active threads processing messages
    `double` | `getAvgSizeReceived()` |
    `double` | `getAvgSizeSent()` |
    `long` | `getBytesReceived()` |
    `long` | `getBytesSent()` |
    `org.apache.axis2.addressing.EndpointReference` | `getEPRForService​(String serviceName, String ip)` | Return the EPR for the given service (implements deprecated method temporarily)
    `org.apache.axis2.addressing.EndpointReference[]` | `getEPRsForService​(String serviceName, String ip)` | Return the EPRs for the given service over this transport
    `long` | `getFaultsReceiving()` |
    `long` | `getFaultsSending()` |
    `long` | `getLastResetTime()` |
    `long` | `getMaxSizeReceived()` |
    `long` | `getMaxSizeSent()` |
    `long` | `getMessagesReceived()` |
    `long` | `getMessagesSent()` |
    `long` | `getMetricsWindow()` |
    `long` | `getMinSizeReceived()` |
    `long` | `getMinSizeSent()` |
    `int` | `getQueueSize()` | Returns the number of requestes queued in the thread pool
    `Map` | `getResponseCodeTable()` |
    `protected String` | `getServiceEPRPrefix​(org.apache.axis2.context.ConfigurationContext cfgCtx, String wsdlEPRPrefix)` | Return the EPR prefix for services made available over this transport
    `protected String` | `getServiceEPRPrefix​(org.apache.axis2.context.ConfigurationContext cfgCtx, String host, int port)` | Return the EPR prefix for services made available over this transport
    `org.apache.axis2.context.SessionContext` | `getSessionContext​(org.apache.axis2.context.MessageContext messageContext)` | TODO: Return session context from transport, this is an improvement in axis2 1.2 and is not currently supported
    `long` | `getTimeoutsReceiving()` |
    `long` | `getTimeoutsSending()` |
    `void` | `init​(org.apache.axis2.context.ConfigurationContext ctx, org.apache.axis2.description.TransportInDescription transportIn)` | Initialize the transport listener, and execute reactor in new separate thread
    `protected ServerConnFactoryBuilder` | `initConnFactoryBuilder​(org.apache.axis2.description.TransportInDescription transportIn, org.apache.http.HttpHost host)` |
    `protected ServerConnFactoryBuilder` | `initConnFactoryBuilder​(org.apache.axis2.description.TransportInDescription transportIn, org.apache.http.HttpHost host, org.apache.axis2.context.ConfigurationContext configurationContext)` |
    `protected Scheme` | `initScheme()` |
    `void` | `maintenenceShutdown​(long millis)` | Stop accepting new connections, and wait the maximum specified time for in-flight requests to complete before a controlled shutdown for maintenence
    `void` | `pause()` | Pause the listener - Stops accepting new connections, but continues processing existing connections until they complete.
    `void` | `reload​(org.apache.axis2.description.TransportInDescription transportIn)` |
    `void` | `reloadDynamicSSLConfig​(org.apache.axis2.description.TransportInDescription transportInDescription)` | Reload SSL profiles and reset connections
    `void` | `reloadSpecificEndpoints​(org.apache.axis2.description.TransportInDescription transportIn)` | Restart specific endpoints which was updated by new configurations
    `void` | `resetStatistics()` |
    `void` | `resume()` | Resume the lister - Brings the lister into active mode back from a paused state
    `void` | `start()` | Start the transport listener.
    `void` | `stop()` | Stop the listener

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

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

- - ### Field Detail

    - #### ACTIVE_CONNECTION_MONITOR_DELAY

          public static final long ACTIVE_CONNECTION_MONITOR_DELAY

      Delay for ActiveConnectionMonitor
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### HttpCoreNIOListener

          public HttpCoreNIOListener()

  - ### Method Detail

    - #### initScheme

          protected Scheme initScheme()

    - #### initConnFactoryBuilder

          protected ServerConnFactoryBuilder initConnFactoryBuilder​(org.apache.axis2.description.TransportInDescription transportIn,
                                                                    org.apache.http.HttpHost host,
                                                                    org.apache.axis2.context.ConfigurationContext configurationContext)
                                                             throws org.apache.axis2.AxisFault

      Throws:
        `org.apache.axis2.AxisFault`

    - #### initConnFactoryBuilder

          protected ServerConnFactoryBuilder initConnFactoryBuilder​(org.apache.axis2.description.TransportInDescription transportIn,
                                                                    org.apache.http.HttpHost host)
                                                             throws org.apache.axis2.AxisFault

      Throws:
        `org.apache.axis2.AxisFault`

    - #### init

          public void init​(org.apache.axis2.context.ConfigurationContext ctx,
                           org.apache.axis2.description.TransportInDescription transportIn)
                    throws org.apache.axis2.AxisFault

      Initialize the transport listener, and execute reactor in new separate thread
      Specified by:
        `init` in interface `org.apache.axis2.transport.TransportListener`
      Parameters:
        `transportIn` - the description of the http/s transport from Axis2 configuration
      Throws:
        `org.apache.axis2.AxisFault` - on error

    - #### getActiveConnectionsSize

          public int getActiveConnectionsSize()

    - #### getServiceEPRPrefix

          protected String getServiceEPRPrefix​(org.apache.axis2.context.ConfigurationContext cfgCtx,
                                               String host,
                                               int port)

      Return the EPR prefix for services made available over this transport
      Parameters:
        `cfgCtx` - configuration context to retrieve the service context path
        `host` - name of the host
        `port` - listening port
      Returns:
        wsdlEPRPrefix for the listener

    - #### getServiceEPRPrefix

          protected String getServiceEPRPrefix​(org.apache.axis2.context.ConfigurationContext cfgCtx,
                                               String wsdlEPRPrefix)

      Return the EPR prefix for services made available over this transport
      Parameters:
        `cfgCtx` - configuration context to retrieve the service context path
        `wsdlEPRPrefix` - specified wsdlPrefix
      Returns:
        wsdlEPRPrefix for the listener

    - #### start

          public void start()
                     throws org.apache.axis2.AxisFault

      Start the transport listener. This method returns when the listener is ready to accept connections.
      Specified by:
        `start` in interface `org.apache.axis2.transport.TransportListener`
      Throws:
        `org.apache.axis2.AxisFault`

    - #### stop

          public void stop()
                    throws org.apache.axis2.AxisFault

      Stop the listener
      Specified by:
        `stop` in interface `org.apache.axis2.transport.TransportListener`
      Throws:
        `org.apache.axis2.AxisFault` - on error

    - #### pause

          public void pause()
                     throws org.apache.axis2.AxisFault

      Pause the listener - Stops accepting new connections, but continues processing existing connections until they complete. This helps bring an instance into a maintenence mode
      Specified by:
        `pause` in interface `org.apache.axis2.transport.base.ManagementSupport`
      Throws:
        `org.apache.axis2.AxisFault`

    - #### resume

          public void resume()
                      throws org.apache.axis2.AxisFault

      Resume the lister - Brings the lister into active mode back from a paused state
      Specified by:
        `resume` in interface `org.apache.axis2.transport.base.ManagementSupport`
      Throws:
        `org.apache.axis2.AxisFault`

    - #### reload

          public void reload​(org.apache.axis2.description.TransportInDescription transportIn)
                      throws org.apache.axis2.AxisFault

      Throws:
        `org.apache.axis2.AxisFault`

    - #### reloadSpecificEndpoints

          public void reloadSpecificEndpoints​(org.apache.axis2.description.TransportInDescription transportIn)
                                       throws org.apache.axis2.AxisFault

      Restart specific endpoints which was updated by new configurations
      Parameters:
        `transportIn` - TransportInDescription of new configuration
      Throws:
        `org.apache.axis2.AxisFault`

    - #### getActiveThreadCount

          public int getActiveThreadCount()

      Returns the number of active threads processing messages
      Specified by:
        `getActiveThreadCount` in interface `org.apache.axis2.transport.base.ManagementSupport`
      Returns:
        number of active threads processing messages

    - #### getQueueSize

          public int getQueueSize()

      Returns the number of requestes queued in the thread pool
      Specified by:
        `getQueueSize` in interface `org.apache.axis2.transport.base.ManagementSupport`
      Returns:
        queue size

    - #### maintenenceShutdown

          public void maintenenceShutdown​(long millis)
                                   throws org.apache.axis2.AxisFault

      Stop accepting new connections, and wait the maximum specified time for in-flight requests to complete before a controlled shutdown for maintenence
      Specified by:
        `maintenenceShutdown` in interface `org.apache.axis2.transport.base.ManagementSupport`
      Parameters:
        `millis` - a number of milliseconds to wait until pending requests are allowed to complete
      Throws:
        `org.apache.axis2.AxisFault`

    - #### getEPRForService

          public org.apache.axis2.addressing.EndpointReference getEPRForService​(String serviceName,
                                                                                String ip)
                                                                         throws org.apache.axis2.AxisFault

      Return the EPR for the given service (implements deprecated method temporarily)
      Specified by:
        `getEPRForService` in interface `org.apache.axis2.transport.TransportListener`
      Throws:
        `org.apache.axis2.AxisFault`

    - #### getEPRsForService

          public org.apache.axis2.addressing.EndpointReference[] getEPRsForService​(String serviceName,
                                                                                   String ip)
                                                                            throws org.apache.axis2.AxisFault

      Return the EPRs for the given service over this transport
      Specified by:
        `getEPRsForService` in interface `org.apache.axis2.transport.TransportListener`
      Parameters:
        `serviceName` - name of the service
        `ip` - IP address
      Returns:
        the EndpointReferences for this service over the transport
      Throws:
        `org.apache.axis2.AxisFault` - on error

    - #### getSessionContext

          public org.apache.axis2.context.SessionContext getSessionContext​(org.apache.axis2.context.MessageContext messageContext)

      TODO: Return session context from transport, this is an improvement in axis2 1.2 and is not currently supported
      Specified by:
        `getSessionContext` in interface `org.apache.axis2.transport.TransportListener`
      Parameters:
        `messageContext` - context to be used
      Returns:
        always null

    - #### destroy

          public void destroy()

      Specified by:
        `destroy` in interface `org.apache.axis2.transport.TransportListener`

    - #### getMessagesReceived

          public long getMessagesReceived()

      Specified by:
        `getMessagesReceived` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getFaultsReceiving

          public long getFaultsReceiving()

      Specified by:
        `getFaultsReceiving` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getBytesReceived

          public long getBytesReceived()

      Specified by:
        `getBytesReceived` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getMessagesSent

          public long getMessagesSent()

      Specified by:
        `getMessagesSent` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getFaultsSending

          public long getFaultsSending()

      Specified by:
        `getFaultsSending` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getBytesSent

          public long getBytesSent()

      Specified by:
        `getBytesSent` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getTimeoutsReceiving

          public long getTimeoutsReceiving()

      Specified by:
        `getTimeoutsReceiving` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getTimeoutsSending

          public long getTimeoutsSending()

      Specified by:
        `getTimeoutsSending` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getMinSizeReceived

          public long getMinSizeReceived()

      Specified by:
        `getMinSizeReceived` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getMaxSizeReceived

          public long getMaxSizeReceived()

      Specified by:
        `getMaxSizeReceived` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getAvgSizeReceived

          public double getAvgSizeReceived()

      Specified by:
        `getAvgSizeReceived` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getMinSizeSent

          public long getMinSizeSent()

      Specified by:
        `getMinSizeSent` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getMaxSizeSent

          public long getMaxSizeSent()

      Specified by:
        `getMaxSizeSent` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getAvgSizeSent

          public double getAvgSizeSent()

      Specified by:
        `getAvgSizeSent` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getResponseCodeTable

          public Map getResponseCodeTable()

      Specified by:
        `getResponseCodeTable` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### resetStatistics

          public void resetStatistics()

      Specified by:
        `resetStatistics` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getLastResetTime

          public long getLastResetTime()

      Specified by:
        `getLastResetTime` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### getMetricsWindow

          public long getMetricsWindow()

      Specified by:
        `getMetricsWindow` in interface `org.apache.axis2.transport.base.ManagementSupport`

    - #### reloadDynamicSSLConfig

          public void reloadDynamicSSLConfig​(org.apache.axis2.description.TransportInDescription transportInDescription)
                                      throws org.apache.axis2.AxisFault

      Reload SSL profiles and reset connections
      Parameters:
        `transportInDescription` - TransportInDescription of the configuration
      Throws:
        `org.apache.axis2.AxisFault`