|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mule.providers.AbstractMessageDispatcher
AbstractMessageDispatcher
provides a default dispatch (client)
support for handling threads lifecycle and validation.
Field Summary | |
protected boolean |
connected
|
protected boolean |
connecting
|
protected ConnectionStrategy |
connectionStrategy
|
protected AbstractConnector |
connector
|
protected boolean |
disposed
|
protected UMOImmutableEndpoint |
endpoint
|
protected Log |
logger
logger used by this class |
protected UMOWorkManager |
workManager
Thread pool of Connector sessions |
Fields inherited from interface org.mule.umo.provider.UMOMessageDispatching |
RECEIVE_NO_WAIT, RECEIVE_WAIT_INDEFINITELY |
Constructor Summary | |
AbstractMessageDispatcher(UMOImmutableEndpoint endpoint)
|
Method Summary | |
void |
activate()
This method can perform necessary state updates before any of the UMOMessageDispatching methods are invoked. |
void |
connect()
Make the connection to the underlying transport. |
void |
disconnect()
Disconnect the from the underlying transport |
void |
dispatch(UMOEvent event)
Dispatches an event from the endpoint to the external system |
void |
dispose()
Template method to destroy any resources held by the Message Dispatcher |
protected abstract void |
doConnect()
|
protected abstract void |
doDisconnect()
|
protected abstract void |
doDispatch(UMOEvent event)
|
protected abstract void |
doDispose()
|
protected abstract UMOMessage |
doReceive(long timeout)
Make a specific request to the underlying transport |
protected abstract UMOMessage |
doSend(UMOEvent event)
|
void |
exceptionThrown(Exception e)
|
protected String |
getConnectEventId(UMOImmutableEndpoint endpoint)
|
String |
getConnectionDescription()
Returns a string identifying the underlying resource |
UMOConnector |
getConnector()
Gets the connector for this dispatcher |
UMOImmutableEndpoint |
getEndpoint()
|
boolean |
isConnected()
Determines if this object is connected or not |
protected boolean |
isDoThreading()
|
protected boolean |
isTransactionRollback()
Checks to see if the current transaction has been rolled back |
void |
passivate()
After sending/receiving a message, the dispatcher can use this method e.g. |
UMOMessage |
receive(long timeout)
Make a specific request to the underlying transport |
void |
reconnect()
|
UMOMessage |
send(UMOEvent event)
Sends an event from the endpoint to the external system |
String |
toString()
|
protected boolean |
useRemoteSync(UMOEvent event)
RemoteSync causes the message dispatch to wait for a response to an event on a response channel after it sends the event. |
boolean |
validate()
Determines whether this dispatcher can be reused after message sending/receiving. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected transient Log logger
protected UMOWorkManager workManager
protected final UMOImmutableEndpoint endpoint
protected final AbstractConnector connector
protected boolean disposed
protected ConnectionStrategy connectionStrategy
protected volatile boolean connecting
protected volatile boolean connected
Constructor Detail |
public AbstractMessageDispatcher(UMOImmutableEndpoint endpoint)
Method Detail |
public final void dispatch(UMOEvent event) throws DispatchException
UMOMessageDispatching
dispatch
in interface UMOMessageDispatching
event
- The event to dispatch
DispatchException
- if the event fails to be dispatchedpublic final UMOMessage send(UMOEvent event) throws DispatchException
UMOMessageDispatching
send
in interface UMOMessageDispatching
event
- The event to send
DispatchException
- if the event fails to be dispatchedpublic final UMOMessage receive(long timeout) throws Exception
receive
in interface UMOMessageDispatching
timeout
- the maximum time the operation should block before returning.
The call should return immediately if there is data available. If
no data becomes available before the timeout elapses, null will be
returned
Exception
- if the call to the underlying protocal cuases an exceptionpublic void exceptionThrown(Exception e)
exceptionThrown
in interface ExceptionListener
public boolean validate()
UMOMessageDispatcher
validate
in interface UMOMessageDispatcher
true
if this dispatcher can be reused,
false
otherwise (for example when
Disposable.dispose()
has been called because an Exception was
raised)public void activate()
UMOMessageDispatcher
UMOMessageDispatching
methods are invoked.
activate
in interface UMOMessageDispatcher
{@link UMOMessageDispatcherFactory#activate(org.mule.umo.endpoint.UMOImmutableEndpoint, UMOMessageDispatcher)}
public void passivate()
UMOMessageDispatcher
UMOMessageDispatcher.activate()
.
passivate
in interface UMOMessageDispatcher
{@link UMOMessageDispatcherFactory#passivate(org.mule.umo.endpoint.UMOImmutableEndpoint, UMOMessageDispatcher)}
public final void dispose()
dispose
in interface Disposable
public UMOConnector getConnector()
UMOMessageDispatcher
getConnector
in interface UMOMessageDispatcher
public UMOImmutableEndpoint getEndpoint()
protected boolean useRemoteSync(UMOEvent event)
event
- the current event
public void connect() throws Exception
UMOConnectable
connect
in interface UMOConnectable
Exception
public void disconnect() throws Exception
UMOConnectable
disconnect
in interface UMOConnectable
Exception
protected String getConnectEventId(UMOImmutableEndpoint endpoint)
public final boolean isConnected()
UMOConnectable
isConnected
in interface UMOConnectable
protected boolean isDoThreading()
public String getConnectionDescription()
getConnectionDescription
in interface UMOConnectable
public void reconnect() throws Exception
Exception
protected abstract void doDispose()
protected abstract void doDispatch(UMOEvent event) throws Exception
Exception
protected abstract UMOMessage doSend(UMOEvent event) throws Exception
Exception
protected abstract void doConnect() throws Exception
Exception
protected abstract void doDisconnect() throws Exception
Exception
protected abstract UMOMessage doReceive(long timeout) throws Exception
timeout
- the maximum time the operation should block before returning.
The call should return immediately if there is data available. If
no data becomes available before the timeout elapses, null will be
returned
Exception
- if the call to the underlying protocal cuases an exceptionprotected boolean isTransactionRollback()
public String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |