|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.xmlBlaster.util.dispatch.DispatchConnectionsHandler
public abstract class DispatchConnectionsHandler
Holding all necessary infos to establish a remote connection and invoke update()/updateOneway()/ping().
This instance is a 'logical connection' hiding multiple 'physical' connections (called DispatchConnection).
One instance of this is used for each DispatchManager (one logical connection).
State chart of the 'logical connection', initially UNDEF: +<-----------------initialize()--------------+ | | | +<--toAlive()----+ +<-initialize()+ | | | initialize() | | | | | | | | | | ######### ########## ########## # # # # # # # ALIVE # # POLLING # # DEAD # # # # # # # ######### ########## ########## | | | | | | | +--toPolling()-->+ +--toDead()-->+ | | initialize() initialize() | | | +------------------toDead()----------------->+ initialize()
Note: Recovery from dead state is only possible if new callback addresses are passed with initialize()
Note: toAlive(), toPolling() and toDead() are called by a single DispatchConnection only, telling its state change.
Field Summary | |
---|---|
private java.util.ArrayList |
conList
holds all DispatchConnection instances |
protected I_DispatchManager |
dispatchManager
|
protected Global |
glob
|
private static java.util.logging.Logger |
log
|
java.lang.String |
ME
|
protected I_PostSendListener |
postSendListener
|
private ConnectionStateEnum |
state
|
protected DispatchStatistic |
statistic
|
Constructor Summary | |
---|---|
DispatchConnectionsHandler(Global glob,
I_DispatchManager dispatchManager)
You need to call initialize() after construction. |
Method Summary | |
---|---|
void |
addDispatchConnection(DispatchConnection con)
|
void |
clearDispatchConnectionList()
|
abstract DispatchConnection |
createDispatchConnection(AddressBase address)
Create a DispatchConnection instance and load the protocol plugin. |
abstract void |
createFakedReturnObjects(I_QueueEntry[] entries,
java.lang.String state,
java.lang.String stateInfo)
If no connection is available but the message is for example save queued, we can generate here valid return objects |
abstract java.util.ArrayList |
filterDistributorEntries(java.util.ArrayList entries,
java.lang.Throwable ex)
|
AddressBase |
getAliveAddress()
|
DispatchConnection |
getAliveDispatchConnection()
|
int |
getCountDispatchConnection()
|
DispatchConnection |
getCurrentDispatchConnection()
|
AddressBase |
getDeadAddress()
|
DispatchConnection |
getDeadDispatchConnection()
|
DispatchConnection[] |
getDispatchConnectionArr()
|
I_DispatchManager |
getDispatchManager()
|
DispatchStatistic |
getDispatchStatistic()
|
DispatchConnection |
getPollingDispatchConnection()
|
I_PostSendListener |
getPostSendListener()
Access the listener for send messages. |
ConnectionStateEnum |
getState()
|
void |
initialize(AddressBase[] cbAddr)
Overwrite existing connections with new configuration |
boolean |
isAlive()
|
boolean |
isDead()
|
boolean |
isPolling()
|
boolean |
isUndef()
|
abstract boolean |
isUserThread()
|
void |
registerPostSendListener(I_PostSendListener postSendListener)
Register a listener to get notifications when a messages is successfully send. |
private void |
removeDispatchConnection(DispatchConnection con)
|
void |
send(MsgQueueEntry[] msgArr,
boolean isAsyncMode)
Send the messages back to the client. |
void |
shutdown()
Stop all callback drivers of this client. |
(package private) void |
toAlive(DispatchConnection con)
Call by DispatchConnection on state transition |
(package private) void |
toDead(DispatchConnection con,
XmlBlasterException ex)
Call by DispatchConnection on state transition |
(package private) void |
toPolling(DispatchConnection con)
Call by DispatchConnection on state transition |
java.lang.String |
toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string. |
private void |
updateState(XmlBlasterException ex)
Handles the state transition |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final java.lang.String ME
protected final Global glob
private static java.util.logging.Logger log
protected final I_DispatchManager dispatchManager
protected final DispatchStatistic statistic
protected I_PostSendListener postSendListener
private java.util.ArrayList conList
private ConnectionStateEnum state
Constructor Detail |
---|
public DispatchConnectionsHandler(Global glob, I_DispatchManager dispatchManager) throws XmlBlasterException
dispatchManager
- The message queue witch i belong tocbAddr
- The addresses i shall connect to
XmlBlasterException
Method Detail |
---|
public final I_DispatchManager getDispatchManager()
public final I_PostSendListener getPostSendListener()
public final void registerPostSendListener(I_PostSendListener postSendListener)
postSendListener
- The postSendListener to set.public final void initialize(AddressBase[] cbAddr) throws XmlBlasterException
XmlBlasterException
public abstract DispatchConnection createDispatchConnection(AddressBase address) throws XmlBlasterException
XmlBlasterException
public final DispatchConnection getCurrentDispatchConnection()
public final DispatchConnection getAliveDispatchConnection()
public final DispatchConnection getPollingDispatchConnection()
public final AddressBase getAliveAddress()
public final AddressBase getDeadAddress()
public final DispatchConnection getDeadDispatchConnection()
public DispatchConnection[] getDispatchConnectionArr()
public int getCountDispatchConnection()
public void addDispatchConnection(DispatchConnection con)
public void clearDispatchConnectionList()
final void toAlive(DispatchConnection con)
final void toPolling(DispatchConnection con)
final void toDead(DispatchConnection con, XmlBlasterException ex)
private final void updateState(XmlBlasterException ex)
XmlBlasterException
- can be nullpublic final boolean isUndef()
public final boolean isAlive()
public final boolean isPolling()
public final boolean isDead()
public ConnectionStateEnum getState()
private final void removeDispatchConnection(DispatchConnection con)
public abstract void createFakedReturnObjects(I_QueueEntry[] entries, java.lang.String state, java.lang.String stateInfo) throws XmlBlasterException
state
- e.g. Constants.STATE_OK
XmlBlasterException
public void send(MsgQueueEntry[] msgArr, boolean isAsyncMode) throws java.lang.Throwable, XmlBlasterException
The RETURN value is transferred in the msgArr[i].getReturnObj(), for oneway updates it is null
isAsyncMode
- true if coming from queue
java.lang.Throwable
XmlBlasterException
public final DispatchStatistic getDispatchStatistic()
public abstract boolean isUserThread()
public final void shutdown()
public final java.lang.String toXml(java.lang.String extraOffset)
extraOffset
- indenting of tags for nice output
public abstract java.util.ArrayList filterDistributorEntries(java.util.ArrayList entries, java.lang.Throwable ex)
|
xmlBlaster 2.2.0 API | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |