public class ClientRemotePojoFactory extends Object
guaranteed delivery, the timeout,
async send mode and send throttling. These configuration settings
define how the proxies will behave. If a remote POJO interface is annotated to indicate those settings (e.g. with
Timeout or other remote POJO annotations), the annotations will take effect and override the settings in this
class unless this object was told to ignore those annotations.| Modifier and Type | Class and Description |
|---|---|
static class |
ClientRemotePojoFactory.GuaranteedDelivery
Settings describing whether this factory generates proxies that have guaranteed delivery by default.
|
| Constructor and Description |
|---|
ClientRemotePojoFactory(ClientCommandSender ccs)
Constructor for
ClientRemotePojoFactory. |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getRemotePojo(Class<T> targetInterface)
Called
getRemotePojo(Class, Long) with a null timeout. |
<T> T |
getRemotePojo(Class<T> targetInterface,
Long timeoutOverride)
This method returns a proxy to the remote POJO.
|
Long |
getTimeout()
Returns the timeout (in milliseconds) that any new
proxies will use for all POJO
calls. |
boolean |
isAsynch()
Returns
true if new remote POJO proxies should make their invocations asynchronously;
false means the invocations will be synchronous (and thus act like a "normal" method call). |
boolean |
isDeliveryGuaranteed()
Returns the flag to indicate if the remote POJO calls should be made with guaranteed delivery.
|
boolean |
isIgnoreAnnotations()
If
true, any remote POJO proxy returned by getRemotePojo(Class) will ignore all annotations
define in that remote POJO's interface which allows you to override settings hardcoded in the annotations with
settings defined in this class (e.g. |
boolean |
isSendThrottled()
Returns the flag to indicate if the remote POJO calls should be "send-throttleable", that is, will need to pass
the send-throttle before it will be sent.
|
void |
setAsynch(boolean is_async,
CommandResponseCallback callback)
Tells this object to make any new remote POJO proxies (via
getRemotePojo(Class)) such that they send
their invocations asynchronously. |
void |
setDeliveryGuaranteed(ClientRemotePojoFactory.GuaranteedDelivery guaranteed)
Sets the flag to indicate if the remote POJO calls should be made with guaranteed delivery.
|
void |
setIgnoreAnnotations(boolean ignore)
Indicates if remote POJO interface annotations are to be ignored or not.
|
void |
setSendThrottled(boolean throttled)
Sets the flag to indicate if the remote POJO calls should be "send-throttleable".
|
void |
setTimeout(Long timeoutMillis)
Sets the timeout (in milliseconds) that all POJO calls will be configured with.
|
public ClientRemotePojoFactory(ClientCommandSender ccs)
ClientRemotePojoFactory.ccs - the object that will be used to send the remote POJO invocation commandpublic <T> T getRemotePojo(Class<T> targetInterface)
getRemotePojo(Class, Long) with a null timeout. See javadoc of that method for more info.targetInterface - public <T> T getRemotePojo(Class<T> targetInterface, Long timeoutOverride)
accordingly. If asynchronous mode is to be enabled in this proxy, its callback will be set to
the object that was passed to setAsynch(boolean, CommandResponseCallback) (which may or may not be a
null callback).targetInterface - timeoutOverride - overrides the default timeout that this factory would have usedpublic boolean isIgnoreAnnotations()
true, any remote POJO proxy returned by getRemotePojo(Class) will ignore all annotations
define in that remote POJO's interface which allows you to override settings hardcoded in the annotations with
settings defined in this class (e.g. isSendThrottled() will override any DisableSendThrottling
annotation defined in the remote POJO interface). If false, annotations that exist in the remote
POJO interface will take effect - thus overriding any of the settings defined in this object.public void setIgnoreAnnotations(boolean ignore)
isIgnoreAnnotations() for more information.ignore - flag to indicate of remote POJO interface annotations are ignored or notpublic boolean isAsynch()
true if new remote POJO proxies should make their invocations asynchronously;
false means the invocations will be synchronous (and thus act like a "normal" method call).setAsynch(boolean, CommandResponseCallback)public void setAsynch(boolean is_async,
CommandResponseCallback callback)
getRemotePojo(Class)) such that they send
their invocations asynchronously. If is_async is true, then the optional
callback will be used as the callback object that will be notified when the asynchronous remote invocation
has been completed. The callback will receive RemotePojoInvocationCommandResponse objects as the
response. If is_async is false, all proxy remote POJO invocations will be synchronous,
and will thus act just like a "normal" POJO method call.
Setting the async mode will not effect any currently existing remote POJO proxies. If you change the
async mode, you will need to create a new proxy via getRemotePojo(Class) and use that proxy to pick up
the new async mode.
You can call this method to set a callback with is_async set to false;
this allows you to set a callback for use with any POJOs that might be annotated as Asynchronous.
It is recommended that, if you want a callback, you use RemotePojoInvocationFuture as the callback
implementation because that object is able to directly handle RemotePojoInvocationCommandResponse objects
and can perform blocked waits.
is_async - indicates if new proxies to remote POJOs should be in asynchronous modecallback - the callback to be notified when the invocation is complete (may be null)RemotePojoInvocationFuturepublic Long getTimeout()
proxies will use for all POJO
calls. If null is returned, the default will be used (the default is defined by the
ClientCommandSender that was passed into this object's constructor). The timeout indicates how much time
the client should wait for the command to return with a response. If the timeout is exceeded, the command will
abort.null, a default
will be usedpublic void setTimeout(Long timeoutMillis)
getTimeout() for
more information.
Note that setting a new timeout value will not affect any existing proxies that this object previously
created via prior calls to getRemotePojo(Class). You must get a new remote POJO proxy in order for this
new timeout to take effect.
timeoutMillis - the timeout (in milliseconds) that each command will be configured with;
ifnull, a default will be usedpublic boolean isDeliveryGuaranteed()
true if POJO calls should be made with guaranteed delivery; false otherwisepublic void setDeliveryGuaranteed(ClientRemotePojoFactory.GuaranteedDelivery guaranteed)
Note that setting a new guaranteed delivery value will not affect any existing proxies that this object
previously created via prior calls to getRemotePojo(Class). You must get a new remote POJO proxy in
order for this new flag to take effect.
guaranteed - true if the remote POJO call should be made with guaranteed deliverypublic boolean isSendThrottled()
true if POJO calls are to be send-throttledpublic void setSendThrottled(boolean throttled)
Note that setting a new send-throttled flag will not affect any existing proxies that this object
previously created via prior calls to getRemotePojo(Class). You must get a new remote POJO proxy in
order for this new flag to take effect.
throttled - true if the remote POJO call should be send-throttledCopyright © 2008-2013 Red Hat, Inc.. All Rights Reserved.