public class RemoteClientImpl extends AbstractRemote implements RemoteClient
RemoteClient
's base functionality.Modifier and Type | Class and Description |
---|---|
protected static class |
RemoteClientImpl.MethodRequestJobFactoryImpl
Implementation of the
TypedRecyclingFactory creating instances of
the according type. |
protected static class |
RemoteClientImpl.SignOffProxyJobFactoryImpl
Implementation of the
TypedRecyclingFactory creating instances of
the according type. |
AbstractRemote.CancelMethodReplyJobFactoryImpl, AbstractRemote.JobDigesterDaemonFactoryImpl, AbstractRemote.PublishSubjectReplyJobFactoryImpl
RemoteClient.ProxyControl
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 |
---|
RemoteClientImpl() |
RemoteClientImpl(ExecutorService aExecutorService) |
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
close() |
protected void |
close(CloseConnectionMessage aJob)
Takes care of closing the
RemoteClient depending on the
CloseConnectionMessage received from the RemoteServer
counterpart. |
void |
destroy() |
protected 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.
|
<T> T |
getProxy(Class<T> aType)
Returns the proxy which can be cast to the given type.
|
boolean |
hasProxy(Class<?> aType)
Returns true if there is at least one proxy of the given type.
|
boolean |
hasProxy(Object proxy)
Returns true if the provided proxy is contained inside the
RemoteClient . |
boolean |
isBusy()
-------------------------------------------------------------------------
TODO: Enhance the
isBusy() method, e.g. are there any threads
active? |
boolean |
isEmpty() |
protected void |
onProxyPublished(Object aProxy)
Hook when a proxy has been published.
|
protected void |
onProxySignedOff(Object aProxy)
Hook when a proxy has been signed-off.
|
protected void |
onPublishProxy(Class<?> aType)
Hook when a proxy is about to be published.
|
Iterator<Object> |
proxies()
Returns a read-only iterator containing all the proxy objects previously
being published.
|
boolean |
signOffProxy(Object aProxy)
Signs off an instance previously published using the
publishClassDescriptor() method.
|
int |
size() |
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 RemoteClientImpl()
public RemoteClientImpl(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 hasProxy(Object proxy)
RemoteClient
RemoteClient
.hasProxy
in interface RemoteClient
proxy
- The proxy to be tested if it is contained inside the
RemoteClient
.RemoteClient
.public <T> T getProxy(Class<T> aType) throws AmbiguousProxyException, NoSuchProxyException
RemoteClient
AmbiguousProxyException
even if
RemoteClient.hasProxy(Class)
returns true! The method
RemoteClient.hasProxy(Class)
returns true in case at least one proxy of the
given type was found whereas this method only returns a proxy in case
there is exactly one proxy of the required type is present.getProxy
in interface RemoteClient
AmbiguousProxyException
- Thrown in case a proxy for a given type
was requested but more than one proxies matched the requested
type.NoSuchProxyException
- Thrown in case a proxy for a given type was
requested but not any proxy matched the requested type.public boolean hasProxy(Class<?> aType)
RemoteClient
hasProxy
in interface RemoteClient
public Iterator<Object> proxies()
RemoteClient
proxies
in interface RemoteClient
public boolean isEmpty()
isEmpty
in interface org.refcodes.collection.Containable
public boolean signOffProxy(Object aProxy) throws org.refcodes.component.OpenException
RemoteClient
signOffProxy
in interface RemoteClient
aProxy
- An object of type GenericInstanceDescriptor containing the
information needed to sign-off an instance.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.protected 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)
RemoteClient
depending on the
CloseConnectionMessage
received from the RemoteServer
counterpart. In case a RemoteClient
manages a one-to-many
connection to different RemoteServer
instances, then the
CloseConnectionMessage
provides meta data on which
RemoteServer
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 RemoteServer
connection to close.protected void onPublishProxy(Class<?> aType) throws org.refcodes.exception.VetoException
aType
- The type to be stored by the property.org.refcodes.exception.VetoException
- Thrown to signal that an operation is being vetoed
by a third party observing the invocation of the given operation.protected void onProxyPublished(Object aProxy)
aProxy
- The proxy to being published.protected void onProxySignedOff(Object aProxy)
aProxy
- The proxy which has been signed-off.Copyright © 2015. All rights reserved.