public class WriteOptions extends Object implements Cloneable
The default behavior is configured when a store is opened using
KVStoreConfig.
| Constructor and Description |
|---|
WriteOptions()
Creates a
WriteOptions with default values. |
WriteOptions(Durability durability,
long timeout,
TimeUnit timeoutUnit)
Creates a
WriteOptions with the specified parameters. |
WriteOptions(WriteOptions options) |
| Modifier and Type | Method and Description |
|---|---|
protected Object |
clone() |
Durability |
getDurability()
Returns the durability associated with the operation.
|
long |
getTimeout()
Returns the timeout, which is an upper bound on the time interval for
processing the operation.
|
TimeUnit |
getTimeoutUnit()
Returns the unit of the timeout parameter.
|
boolean |
getUpdateTTL()
Returns true if the absolute expiration time is to be modified during
update operations.
|
WriteOptions |
setDurability(Durability durability)
Sets durability of write operation.
|
WriteOptions |
setTimeout(long timeout,
TimeUnit timeoutUnit)
Sets timeout for write operation.
|
WriteOptions |
setUpdateTTL(boolean flag)
Sets whether absolute expiration time will be modified during update.
|
String |
toString() |
public WriteOptions()
WriteOptions with default values.
Same as WriteOptions(null, 0, null)WriteOptions(Durability, long, TimeUnit)public WriteOptions(Durability durability, long timeout, TimeUnit timeoutUnit)
WriteOptions with the specified parameters.
If durability is null, the
default durability is used.
The timeout parameter is an upper bound on the time interval for
processing the operation. A best effort is made not to exceed the
specified limit. If zero, the default request timeout is used.
If timeout is not 0, the timeoutUnit parameter must not
be null.
durability - the write durability to usetimeout - the timeout value to usetimeoutUnit - the TimeUnit used by the
timeout parameterIllegalArgumentException - if timeout is negativeIllegalArgumentException - if timeout is > 0 and timeoutUnit
is nullpublic WriteOptions(WriteOptions options)
public WriteOptions setDurability(Durability durability)
durability - can be null. If null, the
default durability will be used.public WriteOptions setTimeout(long timeout, TimeUnit timeoutUnit)
timeout - the timeout value to usetimeoutUnit - the TimeUnit used by the
timeout parameterIllegalArgumentException - if timeout is negativeIllegalArgumentException - if timeout is > 0 and timeoutUnit
is nullpublic Durability getDurability()
public long getTimeout()
default request timeout is used.public TimeUnit getTimeoutUnit()
TimeUnit or null if the timeout has not been set.public WriteOptions setUpdateTTL(boolean flag)
flag - set to true if the operation should update an existing
record's expiration time.public boolean getUpdateTTL()
protected Object clone() throws CloneNotSupportedException
clone in class ObjectCloneNotSupportedExceptionCopyright (c) 2011, 2017 Oracle and/or its affiliates. All rights reserved.