|
xmlBlaster 1.6.2 client API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectorg.xmlBlaster.util.dispatch.DispatchConnection
Holding all necessary infos to establish a remote connection and check this connection.
State chart of a single connection:
+<--toAlive()----+
| |
######### ########## ##########
# # # # # #
# ALIVE # # POLLING # # DEAD #
# # # # # #
######### ########## ##########
| | | | | |
| +--toPolling()-->+ +--toDead()-->+ |
| |
+-------------toDead()---------------------->+
Note that DispatchConnection can't recover from DEAD state you need to create a new instance if desired
| Field Summary | |
protected AddressBase |
address
|
protected DispatchConnectionsHandler |
connectionsHandler
|
protected Global |
glob
|
java.lang.String |
ME
|
protected java.lang.String |
myId
For logging only |
protected boolean |
physicalConnectionOk
|
static java.lang.String |
PING_THREAD_NAME
|
protected long |
previousBytesRead
|
protected long |
previousBytesWritten
|
protected int |
retryCounter
|
protected boolean |
serverAcceptsRequests
Flag if the remote server is reachable but is not willing to process our requests (standby mode). |
protected ConnectionStateEnum |
state
|
| Constructor Summary | |
DispatchConnection(Global glob,
DispatchConnectionsHandler connectionsHandler,
AddressBase address)
Our loadPlugin() and initialize() needs to be called next. |
|
| Method Summary | |
abstract void |
connectLowlevel()
Connect on protocol layer and try an initial low level ping. |
abstract java.lang.String |
doPing(java.lang.String data)
Does the real ping to the remote server instance. |
abstract void |
doSend(MsgQueueEntry[] msgArr_,
boolean isAsyncMode)
Send the messages. |
void |
finalize()
|
protected abstract boolean |
forcePingFailure()
|
AddressBase |
getAddress()
|
abstract java.lang.String |
getDriverName()
A human readable name of the protocol plugin |
abstract java.lang.String |
getName()
|
ConnectionStateEnum |
getState()
|
protected void |
handleTransition(boolean byDispatchConnectionsHandler,
java.lang.Throwable throwable)
|
void |
initialize()
Connects on protocol level to the server and tries a ping. |
boolean |
isAlive()
|
boolean |
isDead()
|
boolean |
isPolling()
|
boolean |
isUndef()
|
abstract void |
loadPlugin()
The derived class should create an instance of the protocol driver. |
java.lang.String |
ping(java.lang.String data)
Ping the remote server instance (callback of the client or xmlBlaster itself) |
protected java.lang.String |
ping(java.lang.String data,
boolean byDispatchConnectionsHandler)
Ping the xmlBlaster server or callback server of the client. |
protected abstract void |
reconnect()
On reconnect polling try to establish the connection |
abstract I_ProgressListener |
registerProgressListener(I_ProgressListener listener)
Should be overwritten by extending classes. |
abstract void |
resetConnection()
Called on COMMUNICATION errors, reset protocol driver for reconnect polling |
void |
send(MsgQueueEntry[] msgArr,
boolean isAsyncMode)
Send the messages back to the client. |
void |
setAddress(AddressBase address)
|
void |
shutdown()
Stop all remote connections. |
protected void |
spanPingTimer(long timeout,
boolean isPing)
|
void |
timeout(java.lang.Object userData)
We are notified to do the next ping or reconnect polling. |
abstract java.lang.String |
toXml(java.lang.String extraOffset)
Dump state of this object into a XML ASCII string. |
| Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public final java.lang.String ME
protected final Global glob
public static final java.lang.String PING_THREAD_NAME
protected DispatchConnectionsHandler connectionsHandler
protected final java.lang.String myId
protected AddressBase address
protected ConnectionStateEnum state
protected int retryCounter
protected boolean serverAcceptsRequests
protected boolean physicalConnectionOk
protected long previousBytesWritten
protected long previousBytesRead
| Constructor Detail |
public DispatchConnection(Global glob,
DispatchConnectionsHandler connectionsHandler,
AddressBase address)
connectionsHandler - The DevliveryConnectionsHandler witch i belong toaddress - The address i shall connect to| Method Detail |
public void setAddress(AddressBase address)
throws XmlBlasterException
XmlBlasterExceptionpublic abstract java.lang.String getName()
public final void initialize()
throws XmlBlasterException
Calls connectLowLevel() which needs to be implemented by derived classes loadPlugin() needs to be called before.
Called by ClientDispatchConnectionsHandler or CbDispatchConnectionsHandler
XmlBlasterExceptionpublic void finalize()
public final AddressBase getAddress()
public abstract void resetConnection()
public abstract void loadPlugin()
throws XmlBlasterException
XmlBlasterException
public abstract void connectLowlevel()
throws XmlBlasterException
XmlBlasterException - with ErrorCode.COMMUNICATION* if server is not reachable
or other exceptions on other errorspublic abstract java.lang.String getDriverName()
public abstract void doSend(MsgQueueEntry[] msgArr_,
boolean isAsyncMode)
throws XmlBlasterException
isAsyncMode - true if coming from queue
XmlBlasterExceptionpublic abstract I_ProgressListener registerProgressListener(I_ProgressListener listener)
public void send(MsgQueueEntry[] msgArr,
boolean isAsyncMode)
throws XmlBlasterException
msgArr - Should be a copy of the original, since we export it which changes/encrypts the contentisAsyncMode - true if coming from queue
XmlBlasterException
public abstract java.lang.String doPing(java.lang.String data)
throws XmlBlasterException
data - QoS, never null
XmlBlasterExceptionorg.xmlBlaster.protocol.I_XmlBlaster#ping(String)
public final java.lang.String ping(java.lang.String data)
throws XmlBlasterException
XmlBlasterException
protected final java.lang.String ping(java.lang.String data,
boolean byDispatchConnectionsHandler)
throws XmlBlasterException
byDispatchConnectionsHandler - true if invoked by DispatchConnectionsHandler
we can throw exceptions back.
false: If invoked by our timer/ping thread, we need to notify the situation
XmlBlasterException
protected abstract void reconnect()
throws XmlBlasterException
XmlBlasterExceptionpublic final void timeout(java.lang.Object userData)
timeout in interface I_TimeoutuserData - You get bounced back your userData which you passed
with Timeout.addTimeoutListener()
here it is "poll" or null
protected void spanPingTimer(long timeout,
boolean isPing)
throws XmlBlasterException
XmlBlasterException
protected final void handleTransition(boolean byDispatchConnectionsHandler,
java.lang.Throwable throwable)
throws XmlBlasterException
byDispatchConnectionsHandler - true if invoked by DispatchConnectionsHandler,
false if invoked by our timer/ping
XmlBlasterException - If delivery failed
public void shutdown()
throws XmlBlasterException
XmlBlasterExceptionpublic final ConnectionStateEnum getState()
public final boolean isUndef()
public final boolean isAlive()
public final boolean isPolling()
public final boolean isDead()
public abstract java.lang.String toXml(java.lang.String extraOffset)
extraOffset - indenting of tags for nice output
protected abstract boolean forcePingFailure()
|
xmlBlaster 1.6.2 client API | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||