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 ConfigurationContextcfgCtxthe axis2 configuration contextprotected TransportConfigurationconfigTransport Configuration for the respective transportsprotected booleanisNonBlockingis this transport non-blocking?protected org.apache.commons.logging.Loglogthe reference to the actual commons logger to be used for log messagesprotected MetricsCollectormetricsMetrics collector for this transportprotected intstatestate of the listenerprotected booleanuseAxis2ThreadPooluse the thread pool available in the axis2 configuration contextprotected WorkerPoolworkerPoolthe 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 protectedAbstractTransportListener()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 MessageContextcreateMessageContext()Create a new axis MessageContext for an incoming message through this transportvoiddestroy()voiddisableTransportForService(AxisService service)intgetActiveThreadCount()Returns the number of active threads processing messagesdoublegetAvgSizeReceived()doublegetAvgSizeSent()longgetBytesReceived()longgetBytesSent()ConfigurationContextgetConfigurationContext()EndpointReferencegetEPRForService(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.longgetFaultsReceiving()longgetFaultsSending()longgetLastResetTime()longgetMaxSizeReceived()longgetMaxSizeSent()longgetMessagesReceived()longgetMessagesSent()MetricsCollectorgetMetricsCollector()longgetMetricsWindow()longgetMinSizeReceived()longgetMinSizeSent()intgetQueueSize()Return the number of requests queued in the thread poolMapgetResponseCodeTable()SessionContextgetSessionContext(MessageContext messageContext)To get the sessionContext transport dependent manner.longgetTimeoutsReceiving()longgetTimeoutsSending()TransportInDescriptiongetTransportInDescription()StringgetTransportName()protected voidhandleException(String msg, Exception e)voidhandleIncomingMessage(MessageContext msgCtx, Map trpHeaders, String soapAction, String contentType)Process a new incoming message through the axis enginevoidinit(ConfigurationContext cfgCtx, TransportInDescription transportIn)Initialize the generic transport.protected voidlogException(String msg, Exception e)voidmaintenenceShutdown(long millis)Stop processing new messages, and wait the specified maximum time for in-flight requests to complete before a controlled shutdown for maintenencevoidpause()Pause the listener - Stop accepting/processing new messages, but continues processing existing messages until they complete.voidresetStatistics()voidresume()Resume the lister - Brings the lister into active mode back from a paused statevoidstart()protected abstract voidstartListeningForService(AxisService service)voidstop()protected abstract voidstopListeningForService(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:
initin interfaceTransportListener- Parameters:
cfgCtx- the axis configuration contexttransportIn- the transport-in description- Throws:
AxisFault- on error
-
destroy
public void destroy()
- Specified by:
destroyin interfaceTransportListener
-
stop
public void stop() throws AxisFault- Specified by:
stopin interfaceTransportListener- Throws:
AxisFault
-
start
public void start() throws AxisFault- Specified by:
startin interfaceTransportListener- Throws:
AxisFault
-
getEPRsForService
public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault
Description copied from interface:TransportListenerGet 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:
getEPRsForServicein 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:TransportListenerTo get the sessionContext transport dependent manner. So that transport listener can return its own implementation of session managment- Specified by:
getSessionContextin 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 AxisFaultPause 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 AxisFaultResume the lister - Brings the lister into active mode back from a paused state- Throws:
AxisFault- on error
-
maintenenceShutdown
public void maintenenceShutdown(long millis) throws AxisFaultStop 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()
-
-