public abstract class AbstractSAClient extends Object implements SAClient, EmitterAdapter, org.springframework.context.Lifecycle
SAClient implementations.| Modifier and Type | Field and Description |
|---|---|
protected SAClientParameters |
parameters
SA connection parameters
|
protected AtomicBoolean |
running
indicates if the connection is active or not
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractSAClient(SAClientParameters inParameters)
Create a new AbstractSAClient instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addConnectionStatusListener(ConnectionStatusListener inListener)
Adds a connection status listener so that it can receive connection
status notifications.
|
void |
addDataReceiver(DataReceiver inReceiver)
Adds a data receiver so that it can receive all the data received
from the remote source that this client is connected to.
|
void |
close()
Closes the connection to the remote strategy agent.
|
void |
connectionStatusChanged(boolean inOldStatus,
boolean inNewStatus) |
protected void |
doStart()
Execute on start.
|
protected void |
doStop()
Execute on stop.
|
protected void |
failIfClosed()
Fails if the connection to the client has been closed.
|
protected void |
failIfDisconnected()
Fails if the connection to the client is closed or disconnected.
|
SAClientParameters |
getParameters()
The parameters that were specified when connecting to the remote
strategy agent.
|
boolean |
isRunning() |
void |
receiveData(Object inObject) |
void |
removeConnectionStatusListener(ConnectionStatusListener inListener)
Removes a connection status listener that was added previously so that
it no longer receives connection status notifications.
|
void |
removeDataReciever(DataReceiver inReceiver)
Removes a data receiver that was previously added so that it no longer
receives data from the remote source.
|
void |
start() |
void |
stop() |
protected ConnectionException |
wrapRemoteFailure(Exception inFailure)
Creates a connection exception wrapping the supplied exception.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateStrategy, delete, getInstances, getModuleInfo, getProperties, getProviders, getStrategyCreateParms, sendData, setProperties, start, stopprotected final SAClientParameters parameters
protected final AtomicBoolean running
protected AbstractSAClient(SAClientParameters inParameters)
inParameters - an SAClientParameters valueConnectionException - if a connection could not be madepublic boolean isRunning()
isRunning in interface org.springframework.context.Lifecyclepublic final void start()
start in interface org.springframework.context.Lifecyclepublic final void stop()
stop in interface org.springframework.context.Lifecycleprotected void doStart()
protected void doStop()
public final void close()
SAClientThis operation does not throw any exceptions. If any failures are encountered when closing the connection, they are logged.
public void addDataReceiver(DataReceiver inReceiver)
SAClientIf the same receiver is added more than once, it will receive data as many times as it's been added.
The receivers are notified in the reverse order of their addition.
addDataReceiver in interface SAClientinReceiver - the receiver to add. Cannot be null.public void removeDataReciever(DataReceiver inReceiver)
SAClientIf the receiver was added more than once, only its most recently added occurrence will be removed.
removeDataReciever in interface SAClientinReceiver - the receiver to remove. Cannot be null.public void addConnectionStatusListener(ConnectionStatusListener inListener)
SAClientIf the same listener is added more than once, it will receive notifications as many times as it's been added.
The listeners are notified in the reverse order of their addition.
addConnectionStatusListener in interface SAClientinListener - the listener to add. Cannot be null.public void removeConnectionStatusListener(ConnectionStatusListener inListener)
SAClientIf the listener was added more than once, only its most recently added occurrence will be removed.
removeConnectionStatusListener in interface SAClientinListener - the listener to remove. Cannot be null.public SAClientParameters getParameters()
SAClientgetParameters in interface SAClientpublic void receiveData(Object inObject)
receiveData in interface EmitterAdapterpublic void connectionStatusChanged(boolean inOldStatus,
boolean inNewStatus)
connectionStatusChanged in interface EmitterAdapterprotected void failIfDisconnected()
throws ConnectionException
ConnectionException - if the connection to the client is closed or disconnected.protected void failIfClosed()
throws IllegalStateException
IllegalStateException - if the connection to the client has been closed.protected ConnectionException wrapRemoteFailure(Exception inFailure)
If the supplied exception is a RemoteException,
the exception wrapped by it is extracted and wrapped into the
returned exception.
inFailure - the exception that needs to be wrapped.Copyright © 2017. All Rights Reserved.