org.apache.synapse.transport.nhttp
Class HttpCoreNIOListener

java.lang.Object
  extended by org.apache.synapse.transport.nhttp.HttpCoreNIOListener
All Implemented Interfaces:
org.apache.axis2.transport.base.ManagementSupport, TransportListener
Direct Known Subclasses:
HttpCoreNIOSSLListener

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

NIO transport listener for Axis2 based on HttpCore and NIO extensions


Field Summary
 
Fields inherited from interface org.apache.axis2.transport.TransportListener
HOST_ADDRESS, PARAM_PORT
 
Constructor Summary
HttpCoreNIOListener()
           
 
Method Summary
 void destroy()
           
 int getActiveConnectionsSize()
           
 int getActiveThreadCount()
          Returns the number of active threads processing messages
 double getAvgSizeReceived()
           
 double getAvgSizeSent()
           
 long getBytesReceived()
           
 long getBytesSent()
           
 EndpointReference getEPRForService(String serviceName, String ip)
          Return the EPR for the given service (implements deprecated method temporarily)
 EndpointReference[] getEPRsForService(String serviceName, String ip)
          Return the EPRs for the given service over this transport
protected  org.apache.http.nio.reactor.IOEventDispatch getEventDispatch(org.apache.http.nio.NHttpServiceHandler handler, SSLContext sslContext, org.apache.http.impl.nio.reactor.SSLIOSessionHandler sslioSessionHandler, org.apache.http.params.HttpParams params)
           
 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(ConfigurationContext cfgCtx, String wsdlEPRPrefix)
          Return the EPR prefix for services made available over this transport
protected  String getServiceEPRPrefix(ConfigurationContext cfgCtx, String host, int port)
          Return the EPR prefix for services made available over this transport
 SessionContext getSessionContext(MessageContext messageContext)
          TODO: Return session context from transport, this is an improvement in axis2 1.2 and is not currently supported
protected  SSLContext getSSLContext(TransportInDescription transportIn)
          Create the SSLContext to be used by this listener
protected  org.apache.http.impl.nio.reactor.SSLIOSessionHandler getSSLIOSessionHandler(TransportInDescription transportIn)
          Create the SSL IO Session handler to be used by this listener
 long getTimeoutsReceiving()
           
 long getTimeoutsSending()
           
 void init(ConfigurationContext cfgCtx, TransportInDescription transportIn)
          Initialize the transport listener, and execute reactor in new seperate thread
 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 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
 

Constructor Detail

HttpCoreNIOListener

public HttpCoreNIOListener()
Method Detail

getEventDispatch

protected org.apache.http.nio.reactor.IOEventDispatch getEventDispatch(org.apache.http.nio.NHttpServiceHandler handler,
                                                                       SSLContext sslContext,
                                                                       org.apache.http.impl.nio.reactor.SSLIOSessionHandler sslioSessionHandler,
                                                                       org.apache.http.params.HttpParams params)

init

public void init(ConfigurationContext cfgCtx,
                 TransportInDescription transportIn)
          throws AxisFault
Initialize the transport listener, and execute reactor in new seperate thread

Specified by:
init in interface TransportListener
Parameters:
cfgCtx - the Axis2 configuration context
transportIn - the description of the http/s transport from Axis2 configuration
Throws:
AxisFault - on error

getActiveConnectionsSize

public int getActiveConnectionsSize()

getServiceEPRPrefix

protected String getServiceEPRPrefix(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(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

getSSLContext

protected SSLContext getSSLContext(TransportInDescription transportIn)
                            throws AxisFault
Create the SSLContext to be used by this listener

Parameters:
transportIn - transport in description
Returns:
always null
Throws:
AxisFault - never thrown

getSSLIOSessionHandler

protected org.apache.http.impl.nio.reactor.SSLIOSessionHandler getSSLIOSessionHandler(TransportInDescription transportIn)
                                                                               throws AxisFault
Create the SSL IO Session handler to be used by this listener

Parameters:
transportIn - transport in descritption
Returns:
always null
Throws:
AxisFault - never thrown

start

public void start()
           throws AxisFault
Start the transport listener. This method returns when the listener is ready to accept connections.

Specified by:
start in interface TransportListener
Throws:
AxisFault

stop

public void stop()
          throws AxisFault
Stop the listener

Specified by:
stop in interface TransportListener
Throws:
AxisFault - on error

pause

public void pause()
           throws 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:
AxisFault

resume

public void resume()
            throws 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:
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 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:
AxisFault

getEPRForService

public EndpointReference getEPRForService(String serviceName,
                                          String ip)
                                   throws AxisFault
Return the EPR for the given service (implements deprecated method temporarily)

Specified by:
getEPRForService in interface TransportListener
Throws:
AxisFault

getEPRsForService

public EndpointReference[] getEPRsForService(String serviceName,
                                             String ip)
                                      throws AxisFault
Return the EPRs for the given service over this transport

Specified by:
getEPRsForService in interface TransportListener
Parameters:
serviceName - name of the service
ip - IP address
Returns:
the EndpointReferences for this service over the transport
Throws:
AxisFault - on error

getSessionContext

public SessionContext getSessionContext(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 TransportListener
Parameters:
messageContext - context to be used
Returns:
always null

destroy

public void destroy()
Specified by:
destroy in interface 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


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.