public abstract class AbstractRemote extends org.refcodes.component.impls.AbstractConnectableAutomaton 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.Destroyable.DestroyAutomaton
org.refcodes.component.ConnectableComponent.ConnectableAutomaton
org.refcodes.component.ConnectionComponent.ConnectionAutomaton<CON>
org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<CON>
org.refcodes.component.OpenedAccessor.OpenedMutator, org.refcodes.component.OpenedAccessor.OpenedProperty
org.refcodes.component.Closable.CloseAutomaton
org.refcodes.component.ClosedAccessor.ClosedMutator, org.refcodes.component.ClosedAccessor.ClosedProperty
Constructor and Description |
---|
AbstractRemote()
Constructs a
AbstractRemote provided with the given
InterProcessDigester and configured with an
ExecutorService something like
ControlFlowUtility.createDaemonExecutorService() . |
AbstractRemote(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(Message aJob)
The
digest(Message) method is invoked in order to trigger
processing of the provided Message , e.g. start execution
depending on the Message instance being provided from the
outside. |
protected void |
fromSender(Message aJob)
Provides an
Message 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(org.refcodes.io.DatagramTransceiver<Serializable> aConnection) |
protected void |
onClosed()
Hook when the connection has been closed.
|
protected void |
onOpened()
Hook when the connection has been opened.
|
void |
open(org.refcodes.io.DatagramTransceiver<Serializable> aTransceiver) |
protected void |
toReceiver(Message aJob)
Forwards an
Message from this sender to another receiver. |
getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, setConnectionStatus
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public AbstractRemote()
AbstractRemote
provided with the given
InterProcessDigester
and configured with an
ExecutorService
something like
ControlFlowUtility.createDaemonExecutorService()
.aTransceiver
- The DatagramTransceiver
to be used for establishing a
connection with the according counterpart.public AbstractRemote(ExecutorService aExecutorService)
AbstractRemote
configured with the given
ExecutorService
required for thread generation in an JEE
environment.aTransceiver
- The DatagramTransceiver
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(org.refcodes.io.DatagramTransceiver<Serializable> aConnection)
isOpenable
in interface org.refcodes.component.ConnectionOpenable.ConnectionOpenAutomaton<org.refcodes.io.DatagramTransceiver<Serializable>>
public void open(org.refcodes.io.DatagramTransceiver<Serializable> aTransceiver) throws org.refcodes.component.OpenException
open
in interface org.refcodes.component.ConnectionOpenable<org.refcodes.io.DatagramTransceiver<Serializable>>
org.refcodes.component.OpenException
public void close() throws org.refcodes.component.CloseException
close
in interface org.refcodes.component.Closable
close
in class org.refcodes.component.impls.AbstractConnectableAutomaton
org.refcodes.component.CloseException
public void destroy()
destroy
in interface org.refcodes.component.Destroyable
protected abstract void digest(Message aJob) throws org.refcodes.component.DigestException
digest(Message)
method is invoked in order to trigger
processing of the provided Message
, e.g. start execution
depending on the Message
instance being provided from the
outside. A RemoteClient
digests such a Message
different
than a RemoteServer
.
This method is inspired by the Digester.digest(Object)
method.protected void toReceiver(Message aJob) throws org.refcodes.component.OpenException
Message
from this sender to another receiver. A
sub-class invokes this method when it sends an Message
to the
receiver counterpart. The communication path is to be implemented by the
sub-class.aJob
- the Message
to be forwarded to this receiver from the
sender counterpart.org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.protected void fromSender(Message aJob)
Message
from another sender to this receiver. A
sub-class invokes this method when it receives an Message
from a
sender counterpart. The communication path is to be implemented by the
sub-class.aJob
- the Message
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()
DatagramTransceiver
is being supported by a sub-class, then the
DatagramTransceiver
's OpenEvent
can be used to trigger this
method.protected void onClosed()
Copyright © 2016. All rights reserved.