public class KVStoreConfig extends Object implements Serializable, Cloneable, KVSecurityConstants
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_LOB_TIMEOUT
The default timeout value (10000 ms) associated with internal
LOB access during operations on LOBs.
|
static int |
DEFAULT_OPEN_TIMEOUT
The default open timeout in ms associated with the sockets used to make
KVStore requests.
|
static int |
DEFAULT_READ_TIMEOUT
The default read timeout in ms associated with the sockets used to make
KVStore requests.
|
static int |
DEFAULT_REQUEST_TIMEOUT
The default timeout in ms associated with KVStore requests.
|
AUTH_PWDFILE_PROPERTY, AUTH_USERNAME_PROPERTY, AUTH_WALLET_PROPERTY, SECURITY_FILE_PROPERTY, SSL_CIPHER_SUITES_PROPERTY, SSL_HOSTNAME_VERIFIER_PROPERTY, SSL_PROTOCOLS_PROPERTY, SSL_TRANSPORT_NAME, SSL_TRUSTSTORE_FILE_PROPERTY, SSL_TRUSTSTORE_TYPE_PROPERTY, TRANSPORT_PROPERTY
Constructor and Description |
---|
KVStoreConfig(String storeName,
String... helperHostPort)
Creates a config object with the minimum required properties.
|
Modifier and Type | Method and Description |
---|---|
KVStoreConfig |
clone() |
Consistency |
getConsistency()
Returns the default read Consistency.
|
Durability |
getDurability()
Returns the default write Durability.
|
String[] |
getHelperHosts()
Returns the helper host/port pairs.
|
String |
getLOBSuffix()
Returns the default suffix associated with LOB keys.
|
long |
getLOBTimeout(TimeUnit unit)
Returns the default timeout value (in ms) associated with chunk access
during operations on LOBs.
|
long |
getLOBVerificationBytes()
Returns the number of trailing bytes of a partial LOB that must be
verified against the user supplied LOB stream when resuming a LOB
put operation. |
long |
getOpenTimeout(TimeUnit unit)
Deprecated.
|
String[] |
getReadZones()
Returns the zones in which nodes must be located to be used for read
operations, or
null if read operations can be performed on nodes
in any zone. |
RequestLimitConfig |
getRequestLimit()
Returns the configuration describing how the number of active requests
to a node are limited.
|
long |
getRequestTimeout(TimeUnit unit)
Returns the default request timeout.
|
long |
getSocketOpenTimeout(TimeUnit unit)
Returns the socket open timeout.
|
long |
getSocketReadTimeout(TimeUnit unit)
Returns the read timeout associated with the sockets used to
make requests.
|
String |
getStoreName()
Returns the store name.
|
KVStoreConfig |
setConsistency(Consistency consistency)
Configures the default read Consistency to be used when a Consistency is
not specified for a particular read operation.
|
KVStoreConfig |
setDurability(Durability durability)
Configures the default write Durability to be used when a Durability is
not specified for a particular write operation.
|
KVStoreConfig |
setHelperHosts(String... helperHostPort)
Configures the helper host/port pairs.
|
KVStoreConfig |
setLOBSuffix(String lobSuffix)
Configures the default suffix associated with LOB keys.
|
KVStoreConfig |
setLOBTimeout(long timeout,
TimeUnit unit)
Configures default timeout value associated with chunk access during
operations on LOBs.
|
KVStoreConfig |
setLOBVerificationBytes(long lobVerificationBytes)
Configures the number of trailing bytes of a partial LOB that must be
verified against the user supplied LOB stream when resuming a
putLOB operation. |
KVStoreConfig |
setOpenTimeout(long timeout,
TimeUnit unit)
Deprecated.
|
KVStoreConfig |
setReadZones(String... zones)
Sets the zones in which nodes must be located to be used for read
operations.
|
KVStoreConfig |
setRequestLimit(RequestLimitConfig requestLimitConfig)
Configures the maximum number of requests that can be active for a node
in the KVStore.
|
KVStoreConfig |
setRequestTimeout(long timeout,
TimeUnit unit)
Configures the default request timeout.
|
KVStoreConfig |
setSecurityProperties(Properties securityProps)
Configures security properties for the client.
|
KVStoreConfig |
setSocketOpenTimeout(long timeout,
TimeUnit unit)
Configures the open timeout used when establishing sockets used to make
client requests.
|
KVStoreConfig |
setSocketReadTimeout(long timeout,
TimeUnit unit)
Configures the read timeout associated with the underlying sockets used
to make client requests.
|
KVStoreConfig |
setStoreName(String storeName)
Configures the store name.
|
String |
toString() |
public static final int DEFAULT_REQUEST_TIMEOUT
public static final int DEFAULT_OPEN_TIMEOUT
public static final int DEFAULT_READ_TIMEOUT
The default read timeout value must be larger than
DEFAULT_REQUEST_TIMEOUT
to ensure that read requests are not
timed out by the socket.
public static final int DEFAULT_LOB_TIMEOUT
public KVStoreConfig(String storeName, String... helperHostPort) throws IllegalArgumentException
storeName
- the name of the KVStore. The store name is used to
guard against accidental use of the wrong host or port. The store name
must consist entirely of upper or lowercase, letters and digits.helperHostPort
- one or more strings containing the host and port
of an active node in the KVStore. Each string has the format:
hostname:port. It is good practice to pass multiple hosts so that if
one host is down, the system will attempt to open the next one, and
so on.IllegalArgumentException
- if an argument has an illegal value.
This may be thrown if the
"oracle.kv.security" property
is set and an error occurs while attempting to read that file.public KVStoreConfig clone()
public KVStoreConfig setStoreName(String storeName) throws IllegalArgumentException
storeName
- the name of the KVStore. The store name is used to
guard against accidental use of the wrong host or port. The store name
must consist entirely of upper or lowercase, letters and digits.IllegalArgumentException
public String getStoreName()
If it is not overridden by calling setStoreName(java.lang.String)
, the
default value is the one specified to the KVStoreConfig
constructor.
public KVStoreConfig setHelperHosts(String... helperHostPort) throws IllegalArgumentException
helperHostPort
- one or more strings containing the host and port
of an active node in the KVStore. Each string has the format:
hostname:port. It is good practice to pass multiple hosts so that if
one host is down, the system will attempt to open the next one, and
so on.IllegalArgumentException
- if no helperHostPort is specified.public String[] getHelperHosts()
If it is not overridden by calling setHelperHosts(java.lang.String...)
, the
default value is the one specified to the KVStoreConfig
constructor.
public KVStoreConfig setSocketOpenTimeout(long timeout, TimeUnit unit) throws IllegalArgumentException
The client does not directly open sockets when making requests. KVStore manages the network connections used to make client requests opening and closing connections as needed.
Please note that the socket timeout applies to any duplicate KVStore handles to the same KVStore within this process.
timeout
- the socket open timeout.unit
- the TimeUnit
of the timeout value.IllegalArgumentException
- if the timeout value is negative or
zero.DEFAULT_OPEN_TIMEOUT
@Deprecated public KVStoreConfig setOpenTimeout(long timeout, TimeUnit unit) throws IllegalArgumentException
setSocketOpenTimeout(long, java.util.concurrent.TimeUnit)
IllegalArgumentException
public long getSocketOpenTimeout(TimeUnit unit)
If it is not overridden by calling setOpenTimeout(long, java.util.concurrent.TimeUnit)
, the
default value is 5000 milliseconds.
unit
- the TimeUnit
of the returned value. May not be null.@Deprecated public long getOpenTimeout(TimeUnit unit)
getSocketOpenTimeout(java.util.concurrent.TimeUnit)
public KVStoreConfig setSocketReadTimeout(long timeout, TimeUnit unit) throws IllegalArgumentException
The client does not directly manage sockets when making requests. KVStore manages the network connections used to make client requests opening and closing connections as needed.
Please note that the socket timeout applies to any duplicate KVStore handles to the same KVStore within this process.
timeout
- the socket read timeoutunit
- the TimeUnit
of the timeout valueIllegalArgumentException
- if the timeout is invalidpublic long getSocketReadTimeout(TimeUnit unit)
If it is not overridden by calling setSocketReadTimeout(long, java.util.concurrent.TimeUnit)
, the
default value is 30000 milliseconds.
unit
- the TimeUnit
of the returned value. May not be null.public KVStoreConfig setRequestTimeout(long timeout, TimeUnit unit) throws IllegalArgumentException
timeout
- the default request timeout.unit
- the TimeUnit
of the timeout value.IllegalArgumentException
- if the timeout value is negative or
zero.public long getRequestTimeout(TimeUnit unit)
If it is not overridden by calling setRequestTimeout(long, java.util.concurrent.TimeUnit)
, the
default value is DEFAULT_REQUEST_TIMEOUT
.
unit
- the TimeUnit
of the returned value. May not be null.public KVStoreConfig setConsistency(Consistency consistency) throws IllegalArgumentException
consistency
- the default read Consistency.IllegalArgumentException
public Consistency getConsistency()
If it is not overridden by calling setConsistency(oracle.kv.Consistency)
, the
default value is Consistency.NONE_REQUIRED
.
public KVStoreConfig setDurability(Durability durability) throws IllegalArgumentException
durability
- the default write Durability.IllegalArgumentException
public Durability getDurability()
If it is not overridden by calling setDurability(oracle.kv.Durability)
, the
default value is Durability.COMMIT_NO_SYNC
.
public KVStoreConfig setRequestLimit(RequestLimitConfig requestLimitConfig)
The long service times can be due to problems at the node itself, or in the network path to that node. The KVStore request dispatcher will, whenever possible, minimize use of nodes with long service times automatically, by re-routing requests to other nodes that can handle them. So this mechanism provides an additional margin of safety when such re-routing of requests is not possible.
public RequestLimitConfig getRequestLimit()
It returns the default value, documented in RequestLimitConfig
,
if it was not overridden by calling setRequestLimit(oracle.kv.RequestLimitConfig)
.
public long getLOBTimeout(TimeUnit unit)
public KVStoreConfig setLOBTimeout(long timeout, TimeUnit unit)
timeout
- the open timeout.unit
- the TimeUnit
of the timeout value.KVLargeObject.getLOB(oracle.kv.Key, oracle.kv.Consistency, long, java.util.concurrent.TimeUnit)
,
KVLargeObject.putLOB(oracle.kv.Key, java.io.InputStream, oracle.kv.Durability, long, java.util.concurrent.TimeUnit)
public String getLOBSuffix()
KVLargeObject
public KVStoreConfig setLOBSuffix(String lobSuffix)
IllegalArgumentException
being thrown if a LOB object is
created with one LOB suffix and is subsequently accessed
when a different suffix is in effect. Write operations using
inconsistent LOB suffixes may result in LOB storage not being reclaimed.
This method should only be used in the rare case that the default LOB suffix value ".lob" is unsuitable.
lobSuffix
- the LOB suffix string. It must be non-null and
have a length > 0.KVLargeObject
public long getLOBVerificationBytes()
put
operation.KVLargeObject
public KVStoreConfig setLOBVerificationBytes(long lobVerificationBytes)
putLOB
operation.lobVerificationBytes
- the number of bytes to be verified. A value
<=0 disables verification.KVLargeObject
public String[] getReadZones()
null
if read operations can be performed on nodes
in any zone.null
public KVStoreConfig setReadZones(String... zones)
null
, or this method has not
been called, then read operations can be performed on nodes in any zone.
The specified zones must exist at the time that this configuration
object is used to create a store, or else KVStoreFactory.getStore(oracle.kv.KVStoreConfig)
will throw an IllegalArgumentException
.
Zones specified for read operations can include primary and secondary
zones. If the master is not located in any of the specified zones,
either because the zones are all secondary zones or because the master
node is not currently in one of the specified primary zones, then read
operations with Consistency.ABSOLUTE
will fail.
zones
- the zones or null
IllegalArgumentException
- if the array argument is not null
and is either empty or contains null
or duplicate elementspublic KVStoreConfig setSecurityProperties(Properties securityProps)
KVSecurityConstants
for the supported properties.Copyright (c) 2011, 2014 Oracle and/or its affiliates. All rights reserved.