public class RemoteServerImpl extends AbstractRemote implements RemoteServer
RemoteServer
's base functionality.Modifier and Type | Class and Description |
---|---|
protected static class |
RemoteServerImpl.MethodReplyJobFactoryImpl
Implementation of the
TypedRecyclingFactory creating instances of
the according type. |
protected static class |
RemoteServerImpl.PublishProxyJobFactoryImpl
Implementation of the
TypedRecyclingFactory creating instances of
the according type. |
protected static class |
RemoteServerImpl.SignOffJobFactoryImpl
Implementation of the
TypedRecyclingFactory creating instances of
the according type. |
AbstractRemote.CancelMethodReplyJobFactoryImpl, AbstractRemote.JobDigesterDaemonFactoryImpl, AbstractRemote.PublishSubjectReplyJobFactoryImpl
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 |
---|
RemoteServerImpl() |
RemoteServerImpl(ExecutorService aExecutorService) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
close() |
protected void |
close(CloseConnectionMessage aJob)
Takes care of closing the
RemoteServer depending on the
CloseConnectionMessage received from the RemoteClient
counterpart. |
void |
destroy() |
void |
digest(Message aJob)
The
AbstractRemote.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 |
doSendJob(Message aJob)
For testing purposes, any job can be manually pushed into the job process
to the receiver.
|
boolean |
hasSubject(Object obj)
Returns true if the provided subject is contained inside this
RemoteServer . |
boolean |
isBusy()
-------------------------------------------------------------------------
TODO: Enhance the
isBusy() method, e.g. are there any threads
active? |
boolean |
isEmpty() |
protected void |
onSubjectPublished(Object aSubject)
Hook when a subject has been published.
|
protected void |
onSubjectSignedOff(Object aSubject)
Hook when a subject has been signed-off.
|
boolean |
publishSubject(Object aSubject)
Publishes an object to any
RemoteClient connected to the
RemoteServer . |
boolean |
signOffSubject(Object aSubject)
Tries to sign off the (previously published) subject, this can be vetoed
in case the subject is still in use by a
RemoteClient . |
boolean |
signOffSubject(Object aSubject,
int aTimeoutInMs)
Signs off the (previously published) subject, this be vetoed even in case
the subject is still in use by a
RemoteClient , but the veto will
only delay the sign off by the given timeout. |
int |
size() |
Iterator<Object> |
subjects()
Returns an (immutable) iterator containing all the proxy objects
previously being published.
|
fromSender, getExecutorService, isDestroyed, isOpenable, onClosed, onOpened, open, toReceiver
getConnectionStatus, isClosable, isClosed, isOpenable, isOpened, open, setConnectionStatus
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
public RemoteServerImpl()
public RemoteServerImpl(ExecutorService aExecutorService)
public void clear()
clear
in interface org.refcodes.collection.Clearable
public void close()
close
in interface org.refcodes.component.Closable
close
in class AbstractRemote
public boolean isBusy()
isBusy()
method, e.g. are there any threads
active?
-------------------------------------------------------------------------isBusy
in interface org.refcodes.mixin.BusyAccessor
public boolean hasSubject(Object obj)
RemoteServer
RemoteServer
.hasSubject
in interface RemoteServer
obj
- The subject to be tested if it is contained inside the
RemoteServer
.RemoteServer
.public Iterator<Object> subjects()
RemoteServer
RemoteServer.signOffSubject(Object)
method in order to remove a published subject.subjects
in interface RemoteServer
public boolean isEmpty()
isEmpty
in interface org.refcodes.collection.Containable
public boolean publishSubject(Object aSubject) throws org.refcodes.component.OpenException
RemoteServer
RemoteClient
connected to the
RemoteServer
.publishSubject
in interface RemoteServer
aSubject
- A subject being published for inter-process communication
such as remote procedure calls or remote method invocations.org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.public boolean signOffSubject(Object aSubject) throws org.refcodes.component.OpenException, org.refcodes.exception.VetoException
RemoteServer
RemoteClient
.signOffSubject
in interface RemoteServer
aSubject
- Description is currently not available!RemoteClient
threw a VetoException
then the
sign-off is aborted.org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.org.refcodes.exception.VetoException
public boolean signOffSubject(Object aSubject, int aTimeoutInMs) throws org.refcodes.component.OpenException
RemoteServer
RemoteClient
, but the veto will
only delay the sign off by the given timeout.signOffSubject
in interface RemoteServer
aSubject
- The subject to be signed off.aTimeoutInMs
- The timeout to be granted in case the sign-off has
been vetoed, nevertheless the subject will be signed off after the
timeout elapsed.RemoteClient
threw a VetoException
then the
sign-off is aborted.org.refcodes.component.OpenException
- Thrown in case opening or accessing an open line
(connection, junction, link) caused problems.public int size()
size
in interface org.refcodes.collection.Containable
public void destroy()
destroy
in interface org.refcodes.component.Destroyable
destroy
in class AbstractRemote
protected void doSendJob(Message aJob) throws org.refcodes.component.OpenException
aJob
- The job to be pushed to the receiver.org.refcodes.component.OpenException
- Thrown in case the operation failed due to an I/O
malfunction such as the input- or output-connection (of an input-
and output-connection pair) is not available or being
disconnected.public void digest(Message aJob) throws org.refcodes.component.DigestException
AbstractRemote
AbstractRemote.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.digest
in class AbstractRemote
aJob
- The Message
to be digested.org.refcodes.component.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 close(CloseConnectionMessage aJob)
RemoteServer
depending on the
CloseConnectionMessage
received from the RemoteClient
counterpart. In case a RemoteServer
manages a one-to-many
connection to different RemoteClient
instances, then the
CloseConnectionMessage
provides meta data on which
RemoteClient
connection to close.
By default just close()
is being invoked as if having a
one-to-one connection.close
in class AbstractRemote
aJob
- The CloseConnectionMessage
providing additional
information on which RemoteClient
connection to close.protected void onSubjectPublished(Object aSubject)
aSubject
- The subject being published.protected void onSubjectSignedOff(Object aSubject)
aSubject
- The subject which has been signed-off.Copyright © 2015. All rights reserved.