public abstract class AbstractRemote extends org.refcodes.component.impls.AbstractDeviceAutomaton implements Remote
RemoteClient
and RemoteServer
implementations
implementing various factories useful creating and reusing descriptor
instances. The factories provided are of type TypedRecyclingFactory
.Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractRemote.CancelMethodReplyJobFactoryImpl
Implementation of the
TypedRecyclingFactory creating instances of
the according type. |
protected class |
AbstractRemote.JobDigesterDaemonFactoryImpl
A
TypedRecyclingFactory creating JobDigesterDaemonImpl
instances. |
protected static class |
AbstractRemote.PublishSubjectReplyJobFactoryImpl
Implementation of the
TypedRecyclingFactory creating instances of
the according type. |
org.refcodes.component.mixins.Destroyable.DestroyAutomaton
org.refcodes.component.ConnectableComponent.ConnectableAutomaton
org.refcodes.component.DeviceComponent.DeviceAutomaton
org.refcodes.component.mixins.Openable.OpenAutomaton
org.refcodes.component.mixins.OpenedAccessor.OpenedMutator, org.refcodes.component.mixins.OpenedAccessor.OpenedProperty
org.refcodes.component.mixins.Closable.CloseAutomaton
org.refcodes.component.mixins.ClosedAccessor.ClosedMutator, org.refcodes.component.mixins.ClosedAccessor.ClosedProperty
Constructor and Description |
---|
AbstractRemote(org.refcodes.connection.Transceiver<Serializable> aTransceiver)
Constructs a
AbstractRemote provided with the given
InterProcessDigester and configured with an
ExecutorService something like
ControlFlowUtility.createDaemonExecutorService() . |
AbstractRemote(org.refcodes.connection.Transceiver<Serializable> aTransceiver,
ExecutorService aExecutorService)
Constructs a
AbstractRemote configured with the given
ExecutorService required for thread generation in an JEE
environment. |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
close(CloseConnectionMessage aJob)
Closes the
Remote upon a received CloseConnectionMessage . |
void |
destroy() |
protected abstract void |
digest(RemoteMessage aJob)
The
digest(RemoteMessage) method is invoked in order to trigger
processing of the provided RemoteMessage , e.g. start execution
depending on the RemoteMessage instance being provided from the
outside. |
protected void |
fromSender(RemoteMessage aJob)
Provides an
RemoteMessage from another sender to this receiver. |
protected ExecutorService |
getExecutorService()
Hook method for retrieving the
ExecutorService . |
protected boolean |
isDestroyed()
Hook to support the
Destroyable interface, determines the
destroyed status property; set to true when destroy() is called. |
boolean |
isOpenable() |
protected void |
onClosed()
Hook when the connection has been closed.
|
protected void |
onOpened()
Hook when the connection has been opened.
|
void |
open() |
protected void |
toReceiver(RemoteMessage aJob)
Forwards an
RemoteMessage from this sender to another receiver. |
getConnectionStatus, isClosable, isClosed, isOpened, setConnectionStatus
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public AbstractRemote(org.refcodes.connection.Transceiver<Serializable> aTransceiver)
AbstractRemote
provided with the given
InterProcessDigester
and configured with an
ExecutorService
something like
ControlFlowUtility.createDaemonExecutorService()
.aTransceiver
- The Transceiver
to be used for establishing a
connection with the according counterpart.public AbstractRemote(org.refcodes.connection.Transceiver<Serializable> aTransceiver, ExecutorService aExecutorService)
AbstractRemote
configured with the given
ExecutorService
required for thread generation in an JEE
environment.aTransceiver
- The Transceiver
to be used for establishing a
connection with the according counterpart.aExecutorService
- The ExecutorService
to be used, when null
then an ExecutorService
something like
ControlFlowUtility.createDaemonExecutorService()
is then
retrieved.public boolean isOpenable()
isOpenable
in interface org.refcodes.component.mixins.Openable.OpenAutomaton
isOpenable
in class org.refcodes.component.impls.AbstractDeviceAutomaton
public void open() throws org.refcodes.component.traps.OpenException
open
in interface org.refcodes.component.mixins.Openable
open
in class org.refcodes.component.impls.AbstractDeviceAutomaton
org.refcodes.component.traps.OpenException
public void close()
close
in interface org.refcodes.component.mixins.Closable
close
in class org.refcodes.component.impls.AbstractConnectableAutomaton
public void destroy()
destroy
in interface org.refcodes.component.mixins.Destroyable
protected abstract void digest(RemoteMessage aJob) throws org.refcodes.component.traps.DigestException
digest(RemoteMessage)
method is invoked in order to trigger
processing of the provided RemoteMessage
, e.g. start execution
depending on the RemoteMessage
instance being provided from the
outside. A RemoteClient
digests such a RemoteMessage
different than a RemoteServer
.
This method is inspired by the Digester.digest(Object)
method.aJob
- The RemoteMessage
to be digested.org.refcodes.component.traps.DigestException
- Thrown in case digesting (processing) a job by a
Digester.digest(Object)
caused problems; the cause is
usually wrapped by this Exception
.Digester
protected void toReceiver(RemoteMessage aJob) throws org.refcodes.component.traps.OpenException
RemoteMessage
from this sender to another receiver. A
sub-class invokes this method when it sends an RemoteMessage
to
the receiver counterpart. The communication path is to be implemented by
the sub-class.aJob
- the RemoteMessage
to be forwarded to this receiver
from the sender counterpart.org.refcodes.component.traps.OpenException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.protected void fromSender(RemoteMessage aJob)
RemoteMessage
from another sender to this receiver. A
sub-class invokes this method when it receives an RemoteMessage
from a sender counterpart. The communication path is to be implemented by
the sub-class.aJob
- the RemoteMessage
to be forwarded to this receiver
from the sender counterpart.protected ExecutorService getExecutorService()
ExecutorService
.ExecutorService
as used by this implementation.protected void close(CloseConnectionMessage aJob)
Remote
upon a received CloseConnectionMessage
.
Some client ID might be considered in order to determine whether to close
all or just one of many connections.
This default implementation calls close()
(setting the
ConnectionStatus
to be ConnectionStatus.CLOSED
); advanced
implementations just closing dedicated connections may keep the
Remote
itself open (and skip calling close()
and close
only a dedicated connection identified by the meta data of the
CloseConnectionMessage
.aJob
- The CloseConnectionMessage
being received for closing
the connection.protected boolean isDestroyed()
Destroyable
interface, determines the
destroyed status property; set to true when destroy()
is called.protected void onOpened()
Transceiver
is being supported by a sub-class, then the
Transceiver
's OpenEvent
can be used to trigger this
method.protected void onClosed()
Copyright © 2015. All rights reserved.