Package org.apache.axis2.transport.base
Class AbstractTransportSender
- java.lang.Object
-
- org.apache.axis2.handlers.AbstractHandler
-
- org.apache.axis2.transport.base.AbstractTransportSender
-
- All Implemented Interfaces:
Handler
,TransportSender
- Direct Known Subclasses:
JMSSender
,MailTransportSender
,TCPTransportSender
,UDPSender
public abstract class AbstractTransportSender extends AbstractHandler implements TransportSender
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.axis2.engine.Handler
Handler.InvocationResponse
-
-
Field Summary
Fields Modifier and Type Field Description protected ConfigurationContext
cfgCtx
the axis2 configuration contextprotected org.apache.commons.logging.Log
log
the reference to the actual commons logger to be used for log messagesprotected MetricsCollector
metrics
Metrics collector for the sender-
Fields inherited from class org.apache.axis2.handlers.AbstractHandler
handlerDesc
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractTransportSender()
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 void
cleanup(MessageContext msgContext)
Release resources associated with a given message context.MessageContext
createResponseMessageContext(MessageContext outMsgCtx)
Create a new axis MessageContext for an incoming response message through this transport, for the given outgoing messageint
getActiveThreadCount()
Returns the number of active threads processing messagesdouble
getAvgSizeReceived()
double
getAvgSizeSent()
long
getBytesReceived()
long
getBytesSent()
long
getFaultsReceiving()
long
getFaultsSending()
long
getLastResetTime()
long
getMaxSizeReceived()
long
getMaxSizeSent()
long
getMessagesReceived()
long
getMessagesSent()
long
getMetricsWindow()
long
getMinSizeReceived()
long
getMinSizeSent()
int
getQueueSize()
Return the number of requests queued in the thread poolMap
getResponseCodeTable()
long
getTimeoutsReceiving()
long
getTimeoutsSending()
String
getTransportName()
protected void
handleException(String msg)
protected void
handleException(String msg, Exception e)
void
handleIncomingMessage(MessageContext msgCtx, Map trpHeaders, String soapAction, String contentType)
Process a new incoming message (Response) through the axis enginevoid
init(ConfigurationContext cfgCtx, TransportOutDescription transportOut)
Initialize the generic transport sender.Handler.InvocationResponse
invoke(MessageContext msgContext)
This method will be called on each registered handler when a message needs to be processed.protected void
logException(String msg, Exception e)
void
maintenenceShutdown(long millis)
void
pause()
void
resetStatistics()
void
resume()
abstract void
sendMessage(MessageContext msgCtx, String targetEPR, OutTransportInfo outTransportInfo)
void
stop()
protected boolean
waitForSynchronousResponse(MessageContext msgCtx)
Should the transport sender wait for a synchronous response to be received?-
Methods inherited from class org.apache.axis2.handlers.AbstractHandler
flowComplete, getHandlerDesc, getName, getParameter, init, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.axis2.engine.Handler
flowComplete, getHandlerDesc, getName, getParameter, init
-
-
-
-
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
-
metrics
protected MetricsCollector metrics
Metrics collector for the sender
-
-
Method Detail
-
init
public void init(ConfigurationContext cfgCtx, TransportOutDescription transportOut) throws AxisFault
Initialize the generic transport sender.- Specified by:
init
in interfaceTransportSender
- Parameters:
cfgCtx
- the axis configuration contexttransportOut
- the transport-out description- Throws:
AxisFault
- on error
-
stop
public void stop()
- Specified by:
stop
in interfaceTransportSender
-
cleanup
public void cleanup(MessageContext msgContext) throws AxisFault
Description copied from interface:TransportSender
Release resources associated with a given message context. This method is called after processing the response of an invocation of a synchronous out-in operation to allow the transport to release any resources allocated during that invocation.This method is mainly useful for connection oriented transports that return from
Handler.invoke(MessageContext)
before the entire response is available. A transport of this type will construct anInputStream
object and set it as theMessageContext.TRANSPORT_IN
property on theOperationContext
). In order for this to work, the connection must remain open until the response has been processed. This method is then used to release the connection explicitly.- Specified by:
cleanup
in interfaceTransportSender
- Throws:
AxisFault
-
sendMessage
public abstract void sendMessage(MessageContext msgCtx, String targetEPR, OutTransportInfo outTransportInfo) throws AxisFault
- Throws:
AxisFault
-
invoke
public Handler.InvocationResponse invoke(MessageContext msgContext) throws AxisFault
Description copied from interface:Handler
This method will be called on each registered handler when a message needs to be processed. If the message processing is paused by the handler, then this method will be called again for the handler that paused the processing once it is resumed. This method may be called concurrently from multiple threads. Handlers that want to determine the type of message that is to be processed (e.g. response vs request, inbound vs. outbound, etc.) can retrieve that information from the MessageContext via MessageContext.getFLOW() and MessageContext.getAxisOperation().getMessageExchangePattern() APIs.
-
handleIncomingMessage
public void handleIncomingMessage(MessageContext msgCtx, Map trpHeaders, String soapAction, String contentType)
Process a new incoming message (Response) 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
-
createResponseMessageContext
public MessageContext createResponseMessageContext(MessageContext outMsgCtx)
Create a new axis MessageContext for an incoming response message through this transport, for the given outgoing message- Parameters:
outMsgCtx
- the outgoing message- Returns:
- the newly created message context
-
waitForSynchronousResponse
protected boolean waitForSynchronousResponse(MessageContext msgCtx)
Should the transport sender wait for a synchronous response to be received?- Parameters:
msgCtx
- the outgoing message context- Returns:
- true if a sync response is expected
-
getTransportName
public String getTransportName()
-
handleException
protected void handleException(String msg, Exception e) throws AxisFault
- Throws:
AxisFault
-
maintenenceShutdown
public void maintenenceShutdown(long millis) throws AxisFault
- Throws:
AxisFault
-
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()
-
-