Package org.apache.axis2.transport.base
Class AbstractTransportListener
- java.lang.Object
-
- org.apache.axis2.transport.base.AbstractTransportListener
-
- All Implemented Interfaces:
TransportListener
- Direct Known Subclasses:
AbstractTransportListenerEx
public abstract class AbstractTransportListener extends Object implements TransportListener
-
-
Field Summary
Fields Modifier and Type Field Description protected ConfigurationContext
cfgCtx
the axis2 configuration contextprotected TransportConfiguration
config
Transport Configuration for the respective transportsprotected boolean
isNonBlocking
is this transport non-blocking?protected org.apache.commons.logging.Log
log
the reference to the actual commons logger to be used for log messagesprotected MetricsCollector
metrics
Metrics collector for this transportprotected int
state
state of the listenerprotected boolean
useAxis2ThreadPool
use the thread pool available in the axis2 configuration contextprotected WorkerPool
workerPool
the thread pool to execute actual poll invocations-
Fields inherited from interface org.apache.axis2.kernel.TransportListener
HOST_ADDRESS, PARAM_PORT
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractTransportListener()
A constructor that makes subclasses pick up the correct logger
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description MessageContext
createMessageContext()
Create a new axis MessageContext for an incoming message through this transportvoid
destroy()
void
disableTransportForService(AxisService service)
int
getActiveThreadCount()
Returns the number of active threads processing messagesdouble
getAvgSizeReceived()
double
getAvgSizeSent()
long
getBytesReceived()
long
getBytesSent()
ConfigurationContext
getConfigurationContext()
EndpointReference
getEPRForService(String serviceName, String ip)
This is a deprecated method in Axis2 and this default implementation returns the first result from the getEPRsForService() methodprotected EndpointReference[]
getEPRsForService(String serviceName)
EndpointReference[]
getEPRsForService(String serviceName, String ip)
Get the endpoint references for a given service.long
getFaultsReceiving()
long
getFaultsSending()
long
getLastResetTime()
long
getMaxSizeReceived()
long
getMaxSizeSent()
long
getMessagesReceived()
long
getMessagesSent()
MetricsCollector
getMetricsCollector()
long
getMetricsWindow()
long
getMinSizeReceived()
long
getMinSizeSent()
int
getQueueSize()
Return the number of requests queued in the thread poolMap
getResponseCodeTable()
SessionContext
getSessionContext(MessageContext messageContext)
To get the sessionContext transport dependent manner.long
getTimeoutsReceiving()
long
getTimeoutsSending()
TransportInDescription
getTransportInDescription()
String
getTransportName()
protected void
handleException(String msg, Exception e)
void
handleIncomingMessage(MessageContext msgCtx, Map trpHeaders, String soapAction, String contentType)
Process a new incoming message through the axis enginevoid
init(ConfigurationContext cfgCtx, TransportInDescription transportIn)
Initialize the generic transport.protected void
logException(String msg, Exception e)
void
maintenenceShutdown(long millis)
Stop processing new messages, and wait the specified maximum time for in-flight requests to complete before a controlled shutdown for maintenencevoid
pause()
Pause the listener - Stop accepting/processing new messages, but continues processing existing messages until they complete.void
resetStatistics()
void
resume()
Resume the lister - Brings the lister into active mode back from a paused statevoid
start()
protected abstract void
startListeningForService(AxisService service)
void
stop()
protected abstract void
stopListeningForService(AxisService service)
-
-
-
Field Detail
-
log
protected org.apache.commons.logging.Log log
the reference to the actual commons logger to be used for log messages
-
cfgCtx
protected ConfigurationContext cfgCtx
the axis2 configuration context
-
state
protected int state
state of the listener
-
isNonBlocking
protected boolean isNonBlocking
is this transport non-blocking?
-
workerPool
protected WorkerPool workerPool
the thread pool to execute actual poll invocations
-
useAxis2ThreadPool
protected boolean useAxis2ThreadPool
use the thread pool available in the axis2 configuration context
-
metrics
protected MetricsCollector metrics
Metrics collector for this transport
-
config
protected TransportConfiguration config
Transport Configuration for the respective transports
-
-
Method Detail
-
init
public void init(ConfigurationContext cfgCtx, TransportInDescription transportIn) throws AxisFault
Initialize the generic transport. Sets up the transport and the thread pool to be used for message processing. Also creates an AxisObserver that gets notified of service life cycle events for the transport to act on- Specified by:
init
in interfaceTransportListener
- Parameters:
cfgCtx
- the axis configuration contexttransportIn
- the transport-in description- Throws:
AxisFault
- on error
-
destroy
public void destroy()
- Specified by:
destroy
in interfaceTransportListener
-
stop
public void stop() throws AxisFault
- Specified by:
stop
in interfaceTransportListener
- Throws:
AxisFault
-
start
public void start() throws AxisFault
- Specified by:
start
in interfaceTransportListener
- Throws:
AxisFault
-
getEPRsForService
public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault
Description copied from interface:TransportListener
Get the endpoint references for a given service. These are the addresses that a client can use to send requests to the given service through this transport.- Specified by:
getEPRsForService
in interfaceTransportListener
- Parameters:
serviceName
- TODO: this is actually not simply the service name!ip
- The host name or IP address of the local host. The implementation should use this information instead ofInetAddress.getLocalHost()
. The value of this parameter may benull
, in which case the implementation should useUtils.getIpAddress( org.apache.axis2.engine.AxisConfiguration)
.- Returns:
- an array of endpoint references for the given service
- Throws:
AxisFault
-
getEPRsForService
protected EndpointReference[] getEPRsForService(String serviceName)
-
disableTransportForService
public void disableTransportForService(AxisService service)
-
startListeningForService
protected abstract void startListeningForService(AxisService service) throws AxisFault
- Throws:
AxisFault
-
stopListeningForService
protected abstract void stopListeningForService(AxisService service)
-
getEPRForService
public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault
This is a deprecated method in Axis2 and this default implementation returns the first result from the getEPRsForService() method- Throws:
AxisFault
-
getSessionContext
public SessionContext getSessionContext(MessageContext messageContext)
Description copied from interface:TransportListener
To get the sessionContext transport dependent manner. So that transport listener can return its own implementation of session managment- Specified by:
getSessionContext
in interfaceTransportListener
- Parameters:
messageContext
- : MessageContext which has all the relavent data- Returns:
- SessionContext
-
createMessageContext
public MessageContext createMessageContext()
Create a new axis MessageContext for an incoming message through this transport- Returns:
- the newly created message context
-
handleIncomingMessage
public void handleIncomingMessage(MessageContext msgCtx, Map trpHeaders, String soapAction, String contentType) throws AxisFault
Process a new incoming message through the axis engine- Parameters:
msgCtx
- the axis MessageContexttrpHeaders
- the map containing transport level message headerssoapAction
- the optional soap action or nullcontentType
- the optional content-type for the message- Throws:
AxisFault
-
handleException
protected void handleException(String msg, Exception e) throws AxisFault
- Throws:
AxisFault
-
getTransportInDescription
public TransportInDescription getTransportInDescription()
-
getTransportName
public String getTransportName()
-
getConfigurationContext
public ConfigurationContext getConfigurationContext()
-
getMetricsCollector
public MetricsCollector getMetricsCollector()
-
pause
public void pause() throws AxisFault
Pause the listener - Stop accepting/processing new messages, but continues processing existing messages until they complete. This helps bring an instance into a maintenence mode- Throws:
AxisFault
- on error
-
resume
public void resume() throws AxisFault
Resume the lister - Brings the lister into active mode back from a paused state- Throws:
AxisFault
- on error
-
maintenenceShutdown
public void maintenenceShutdown(long millis) throws AxisFault
Stop processing new messages, and wait the specified maximum time for in-flight requests to complete before a controlled shutdown for maintenence- Parameters:
millis
- a number of milliseconds to wait until pending requests are allowed to complete- Throws:
AxisFault
- on error
-
getActiveThreadCount
public int getActiveThreadCount()
Returns the number of active threads processing messages- Returns:
- number of active threads processing messages
-
getQueueSize
public int getQueueSize()
Return the number of requests queued in the thread pool- Returns:
- queue size
-
getMessagesReceived
public long getMessagesReceived()
-
getFaultsReceiving
public long getFaultsReceiving()
-
getBytesReceived
public long getBytesReceived()
-
getMessagesSent
public long getMessagesSent()
-
getFaultsSending
public long getFaultsSending()
-
getBytesSent
public long getBytesSent()
-
getTimeoutsReceiving
public long getTimeoutsReceiving()
-
getTimeoutsSending
public long getTimeoutsSending()
-
getMinSizeReceived
public long getMinSizeReceived()
-
getMaxSizeReceived
public long getMaxSizeReceived()
-
getAvgSizeReceived
public double getAvgSizeReceived()
-
getMinSizeSent
public long getMinSizeSent()
-
getMaxSizeSent
public long getMaxSizeSent()
-
getAvgSizeSent
public double getAvgSizeSent()
-
getResponseCodeTable
public Map getResponseCodeTable()
-
resetStatistics
public void resetStatistics()
-
getLastResetTime
public long getLastResetTime()
-
getMetricsWindow
public long getMetricsWindow()
-
-