|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.neeve.root.RootObject
com.neeve.link.LnkObject
com.neeve.link.LnkContinuousConnector
public class LnkContinuousConnector
Class that continuously retries link establishment till successful or stopped.
This class continuously attempts to establish a link connection until
successful or stopped by the user. The user provides the link descriptor
and associated information needed for link establishment at creation time.
The user then starts the link establishment via start(com.neeve.emx.IEmxDispatcher)
that kicks
off the connection establishment. The connection establishment is retried
at the specified interval until successful or stopped (stop()
) by
the user. The completion (whether that be due to a successful connect,
an error internal to the connector or because the user has stopped the
connect) is communicated to the user via the provided event handler.
LnkContinuousConnector.State
enumerates the various states that a connector can be in.
The user can use the getState()
method to query the state of a
connector. Refer to the method documentation for the states in which
the methods can be invoked.
Nested Class Summary | |
---|---|
static class |
LnkContinuousConnector.State
States of a connector. |
Method Summary | |
---|---|
static LnkContinuousConnector |
create(RootConfig.ObjectConfig config,
String descriptor,
int retryInterval,
ILnkEventHandler userHandler)
Create a continuous link connector. |
static LnkContinuousConnector |
create(RootConfig.ObjectConfig config,
com.neeve.util.UtlAddressDescriptor descriptor,
int retryInterval,
ILnkEventHandler userHandler)
Create a continuous link connector. |
LnkContinuousConnector.State |
getState()
Get the current state of the connector |
void |
start(IEmxDispatcher dispatcher)
Start the connector. |
void |
stop()
Stop the connector. |
Methods inherited from class com.neeve.root.RootObject |
---|
getChecked, getThreaded, getTracer, setChecked, setTracer |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static LnkContinuousConnector create(RootConfig.ObjectConfig config, com.neeve.util.UtlAddressDescriptor descriptor, int retryInterval, ILnkEventHandler userHandler)
config
- The package configuration object to use in the creation
of this object. The allows the parameters used to configure the package
that is using this class to be automatically applied to this object
too.descriptor
- The link descriptor to use.retryInterval
- Interval (in seconds) at which failed connection
attempts will be retried.userHandler
- The handler to which the completion event will be
dispatched.
public static LnkContinuousConnector create(RootConfig.ObjectConfig config, String descriptor, int retryInterval, ILnkEventHandler userHandler)
config
- The package configuration object to use in the creation
of this object. The allows the parameters used to configure the package
that is using this class to be automatically applied to this object
too.descriptor
- The link descriptor to use.retryInterval
- Interval (in seconds) at which failed connection
attempts will be retried.userHandler
- The handler to which the completion event will be
dispatched.
public final void start(IEmxDispatcher dispatcher) throws ELnkInvalidStateException, ELnkNotOwnerException, ELnkOpFailedException
dispatcher
- The dispatcher in whose context the connect should be
run. The caller is responsible for driving this dispatcher upon return
from this method until the completion event is dispatched.
ELnkInvalidStateException
- Thrown in case the connector is not
in the LnkContinuousConnector.State.STOPPED
state.
ELnkNotOwnerException
- Thrown in case the calling thread is not
the owner of the dispatcher provided at the time the connector was
created.
ELnkOpFailedException
- Thrown in case the connector could not
be started.
This method kicks off the connection establishment. The user will be
dispatched an LnkEvents.EVENT_CONTINUOUS_CONNECT_COMPLETE
event
when either the connection is successfully established, an internal
error occurs that prevents the connector from continuing or the user
issues a stop()
call.
public final LnkContinuousConnector.State getState()
public final void stop() throws ELnkInvalidStateException, ELnkOpFailedException
ELnkInvalidStateException
- Thrown in case the connector is not
in the LnkContinuousConnector.State.STARTED
state.
ELnkOpFailedException
- Thrown in case the a stop could not be
scheduled on the connector.
This method schedules a stop on a started connector. It does so by
setting the state of the connector to LnkContinuousConnector.State.STOPPING
. At the
time this method is invoked, the connector either has a connect
pending completion or has an alarm scheduled to retry the connect.
The changing of the state by this method is basically an indication
to the alarm event to not reschedule the connect but to dispatch a
cancellation event. In such as case the user will receive the
LnkEvents.EVENT_CONTINUOUS_CONNECT_COMPLETE
event with the
event data containing a ELnkOpCancelledException
. In case there
was a connect pending at this time this method was called, the result of
the connect will be dispatched to the user as the completion event.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |