|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.realtime.xmpp.util.XmppSessionRestarter
An XMPP event listener that responds to socket close events by re-establishing the XMPP session.
Each new session attempt is done by a separate thread so we don't recurse into oblivion. After the restart is successful, the thread is destroyed.
To disable the automatic restarts, call stop().
Nested Class Summary | |
protected class |
XmppSessionRestarter.StarterThread
Our session starter thread. |
Nested classes inherited from class com.realtime.xmpp.XmppSessionListener |
XmppSessionListener.Event, XmppSessionListener.Type |
Field Summary | |
protected XmppSessionRestarter.StarterThread |
m_activeStarterThread
Our active starter thread. |
protected boolean |
m_bStopped
Signal to our thread that we've been stopped. |
protected XmppSession |
m_session
The session we will restart when failures occur. |
protected java.lang.Object |
m_threadMutex
Protected mucking with out thread. |
Fields inherited from interface com.realtime.xmpp.XmppSessionListener |
AUTHENTICATION_FAILED, CANT_CONNECT, CLOSING_SOCKET, CONNECTION_ERROR, INCOMING_PACKET, OPENING_SOCKET, PARSER_SELECTED, PROTOCOL_ERROR, RESTARTING_CONNECTION, SENDING_PACKET, SESSION_AUTHENTICATED, SESSION_ENDED, SESSION_STARTED, SOCKET_CLOSED, SOCKET_OPEN, STARTING_SESSION, STOPPING_COMPONENT, WAITING |
Constructor Summary | |
XmppSessionRestarter(XmppSession session)
Create the session restarter. |
Method Summary | |
void |
start()
(Re)start the task of listening for failed connections and restarting the session. |
protected void |
startSession()
Create a worker thread and send it off to make sure the new session starts. |
void |
stop()
Stop restarting any failed sessions. |
void |
xmppSessionEvent(XmppSessionListener.Event event)
Respond to SOCKET_CLOSED events by restarting the XMPP session. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected XmppSession m_session
protected boolean m_bStopped
protected XmppSessionRestarter.StarterThread m_activeStarterThread
protected java.lang.Object m_threadMutex
Constructor Detail |
public XmppSessionRestarter(XmppSession session)
Create the session restarter. Each time the XMPP session is closed, this class will start a new one.
To stop this class, call the stop() method.
Method Detail |
public void xmppSessionEvent(XmppSessionListener.Event event)
Respond to SOCKET_CLOSED events by restarting the XMPP session.
xmppSessionEvent
in interface XmppSessionListener
event
- The XMPP session event, as defined in this class.protected void startSession()
public void start()
(Re)start the task of listening for failed connections and restarting the session.
This method should be called after stop(). It is not necessary to call this method after constructing this class.
public void stop()
Stop restarting any failed sessions.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |