public static final class DOFOperation.Control
extends java.lang.Object
implements org.opendof.core.internal.protocol.Marshallable, java.io.Serializable
DOFObject.get(org.opendof.core.oal.DOFInterface.Property, int)
,
DOFObject.beginGet(org.opendof.core.oal.DOFInterface.Property, int)
,
DOFObject.set(org.opendof.core.oal.DOFInterface.Property, org.opendof.core.oal.DOFValue, int)
,
DOFObject.beginSet(org.opendof.core.oal.DOFInterface.Property, org.opendof.core.oal.DOFValue, int)
,
DOFObject.invoke(org.opendof.core.oal.DOFInterface.Method, java.util.List<org.opendof.core.oal.DOFValue>, int)
,
DOFObject.beginInvoke(org.opendof.core.oal.DOFInterface.Method, int, org.opendof.core.oal.DOFValue...)
,
DOFSystem.createSubscription(org.opendof.core.oal.DOFObjectID, org.opendof.core.oal.DOFInterface.Property, int, org.opendof.core.oal.DOFSubscription.Listener, java.lang.Object)
,
DOFSystem.createRegistration(org.opendof.core.oal.DOFObjectID, org.opendof.core.oal.DOFInterface.Event, org.opendof.core.oal.DOFRegistration.Listener, java.lang.Object)
,
Serialized FormModifier and Type | Field and Description |
---|---|
static int |
DEFAULT_RETRY_PERIOD
The default retry period for an operation.
|
static int |
HEURISTIC_ALL
A value indicating randomized acceptance of the operation.
|
static int |
RESPONDERS_ALL
A number that captures *all* responses.
|
Constructor and Description |
---|
Control()
Create a default instance not for unmarshalling.
|
Control(DOFMarshalContext context,
java.lang.Object state,
DOFPacket packet)
Create an instance from serial form.
|
Control(DOFOperation.Control control)
Copy constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addProviderExclusion(DOFObjectID... providers)
Add a variable number of providers to the list of providers who should not respond to
requests made using this Control.
|
void |
addProviderExclusions(java.util.Collection<DOFObjectID> providerIDs)
Add to the list of providers (DOFObjectID's) who should not respond to
requests made using this Control.
|
void |
clearProviderExclusions()
Clear the list of provider exclusions.
|
boolean |
equals(java.lang.Object obj) |
int |
getAckTimeout()
Get the maximum time allowed for this operation to be acknowledged.
|
short |
getHeuristic()
Get the value indicating randomized acceptance of the operation.
|
short |
getMaxCacheAge()
Return the maximum acceptable age of a cached value.
|
int |
getMaxResponderCount()
Get the maximum number of desired responders.
|
java.util.List<DOFObjectID> |
getProviderExclusions()
Get provider exclusions.
|
DOFOperation.ResponseLevel |
getResponseLevel()
Get the operation's level of verbosity for responses.
|
int |
getRetryPeriod()
Get the retry period.
|
DOFOperation.RetryTime |
getRetryTime()
Get the RetryTime.
|
DOFConnection |
getTargetConnection()
Get the target connection.
|
int |
hashCode() |
boolean |
isAutoExclude()
Is the operation auto exclude?
NOTE: This is ignored for OAP Unicast operations (see
DOFObjectID.isUnicast() ,
and DOFOperation.Session, DOFOperation.Register and DOFOperation.Subscribe. |
boolean |
isDefault()
Check whether this Control is equal to the default Control.
|
boolean |
isDelay()
Return whether or not receiving nodes should cause responses to be randomly distributed across the operation's lifetime.
|
boolean |
isFloodAllowed()
Get whether the operation allows broadcast.
|
void |
marshal(DOFMarshalContext context,
java.lang.Object state,
DOFPacket p)
Write an object to a serialized form to the specified buffer, according
to the context specified and with the given state.
|
void |
setAckTimeout(int timeout)
Set the maximum time to allow for the operation to be acknowledged.
|
void |
setAutoExclude(boolean isAutoExclude)
Set whether or not providers, who have previously responded, are automatically
excluded when a request made using this Control is retried.
|
void |
setDelay(boolean isDelay)
Set whether or not receiving nodes should cause responses to be randomly distributed across the operation's lifetime.
|
void |
setFloodAllowed(boolean isAllowBroadcast)
Set whether or not unicast requests (requests made on an object with a specific object ID,
not
DOFObjectID.BROADCAST ) can be broadcast when there is no known route to a provider. |
void |
setHeuristic(short heuristic)
Set randomized acceptance of the operation.
|
void |
setMaxCacheAge(short cacheAge)
Set the maximum acceptable age of a cached value.
|
void |
setMaxResponderCount(int count)
Sets the maximum number of desired responders.
|
void |
setResponseLevel(DOFOperation.ResponseLevel level)
Set the level of verbosity for responses for requests made using this Control.
|
void |
setRetryPeriod(int period)
Set a periodic retry period for requests made using this Control.
|
void |
setRetryTime(DOFOperation.RetryTime retryTime)
Set a retry retryTime to dynamically determine each retry period.
|
void |
setTargetConnection(DOFConnection connection)
Set the connection that the request must use.
|
public static final int HEURISTIC_ALL
public static final int RESPONDERS_ALL
public static final int DEFAULT_RETRY_PERIOD
public Control()
public Control(DOFOperation.Control control)
control
- The original control to copy. This must not be null.public Control(DOFMarshalContext context, java.lang.Object state, DOFPacket packet) throws DOFMarshalException
context
- The context of the unmarshalling to be performed.state
- The state in which the unmarshalling is done. This may affect the result.
In this case, a boolean, where True means the class is an OAPOperation.packet
- The buffer which contains the serialized form of the object. Must not be null.DOFMarshalException
- If there are errors in the data or the buffer. This is an exception to the rule that
non-RuntimeExceptions not be thrown from a constructor.Marshallable
public void setDelay(boolean isDelay)
isDelay
- Whether or not receiving nodes should cause responses to be randomly distributed across the operation's lifetime. Default = false.isDelay
public boolean isDelay()
setDelay(boolean)
public void setMaxResponderCount(int count)
count
- The total number of responses that are desired. Valid values are from 0 (no responses) to 65534,
or 65535 (RESPONDERS_ALL) to leave responses unlimited (the default). This must not be negative.getMaxResponderCount()
public int getMaxResponderCount()
public void setAckTimeout(int timeout)
timeout
- Maximum time allowed for the operation to be acknowledged. The default is DOF.TIMEOUT_NEVER
.public int getAckTimeout()
DOFErrorException.TIMEOUT
is thrown.public void setHeuristic(short heuristic)
heuristic
- The percentage of receivers that should take action based on the request. The valid range
is from 0, representing 0% (or none), to 32767 (HEURISTIC_ALL), representing 100% (or all). The default is 32767
(all). This must not be negative.getHeuristic()
public short getHeuristic()
setHeuristic(short)
public void setResponseLevel(DOFOperation.ResponseLevel level)
level
- The desired verbosity level for responses. Must not be null.getResponseLevel()
public void setRetryPeriod(int period)
setRetryTime(org.opendof.core.oal.DOFOperation.RetryTime)
will apply.period
- The number of milliseconds between retries. This must be > 0.getRetryPeriod()
,
setRetryTime(org.opendof.core.oal.DOFOperation.RetryTime)
public void setRetryTime(DOFOperation.RetryTime retryTime)
setRetryPeriod(int)
or setRetryTime will apply.retryTime
- A user-defined retryTime that will determine when a retry should take place. This must not be null.setRetryPeriod(int)
,
getRetryTime()
public DOFOperation.RetryTime getRetryTime()
setRetryTime(org.opendof.core.oal.DOFOperation.RetryTime)
public void addProviderExclusions(java.util.Collection<DOFObjectID> providerIDs)
providerIDs
- A collection of providers (DOFObjectID's) that should be excluded. This must not be null.public void addProviderExclusion(DOFObjectID... providers)
providers
- The providers that should not respond to request.public void clearProviderExclusions()
public void setAutoExclude(boolean isAutoExclude)
DOFObjectID.isUnicast()
,
and DOFOperation.session, DOFOperation.register and DOFOperation.subscribe.isAutoExclude
- Whether or not providers are automatically excluded on retry.
The default is true.public void setFloodAllowed(boolean isAllowBroadcast)
DOFObjectID.BROADCAST
) can be broadcast when there is no known route to a provider.isAllowBroadcast
- Whether or not unicast requests can be broadcast when there is no known route to a provider.
The default is true.public void setTargetConnection(DOFConnection connection)
connection
- The target connection for requests. If null, this operation will use the normal routing logic (no target connection will apply).getTargetConnection()
public void setMaxCacheAge(short cacheAge)
cacheAge
- The maximum acceptable age of a cached value (in milliseconds). A value of 0 means no cached
values will be accepted (the default). This value will be rounded up to the nearest second.public short getMaxCacheAge()
setMaxCacheAge(short)
public DOFOperation.ResponseLevel getResponseLevel()
setResponseLevel(org.opendof.core.oal.DOFOperation.ResponseLevel)
public int getRetryPeriod()
setRetryPeriod(int)
public java.util.List<DOFObjectID> getProviderExclusions()
setRetryPeriod(int)
public boolean isAutoExclude()
DOFObjectID.isUnicast()
,
and DOFOperation.Session, DOFOperation.Register and DOFOperation.Subscribe.public boolean isFloodAllowed()
DOFObjectID.BROADCAST
) can be broadcast when there is no known route to a provider.public DOFConnection getTargetConnection()
setTargetConnection(org.opendof.core.oal.DOFConnection)
public void marshal(DOFMarshalContext context, java.lang.Object state, DOFPacket p) throws DOFMarshalException
org.opendof.core.internal.protocol.Marshallable
marshal
in interface org.opendof.core.internal.protocol.Marshallable
context
- The context of the marshaling to be performed.state
- The state in which the marshalling is done. This may affect the result.p
- The buffer which will receive the marshaled data. Must not be null.DOFMarshalException
- If there are errors in the data or the buffer.public boolean isDefault()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object