Class ReadOptions

  • Direct Known Subclasses:
    TableIteratorOptions

    public class ReadOptions
    extends java.lang.Object
    ReadOptions is passed to read-only store operations to specify arguments that control non-default behavior related to consistency and operation timeouts.

    The default behavior is configured when a store is opened using KVStoreConfig.

    Since:
    3.0
    • Constructor Summary

      Constructors 
      Constructor Description
      ReadOptions​(Consistency consistency, long timeout, java.util.concurrent.TimeUnit timeoutUnit)
      Creates a ReadOptions with the specified parameters.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      Consistency getConsistency()
      Gets the consistency used for a read operation.
      long getTimeout()
      Gets the timeout, which is an upper bound on the time interval for processing the operation.
      java.util.concurrent.TimeUnit getTimeoutUnit()
      Gets the unit of the timeout parameter, and may be null only if getTimeout() returns zero.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ReadOptions

        public ReadOptions​(Consistency consistency,
                           long timeout,
                           java.util.concurrent.TimeUnit timeoutUnit)
        Creates a ReadOptions with the specified parameters.

        If consistency is null, the default consistency is used.

        If timeout is zero the default request timeout 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.

        Parameters:
        consistency - the read consistency to use or null
        timeout - the timeout value to use
        timeoutUnit - the TimeUnit used by the timeout parameter or null
        Throws:
        java.lang.IllegalArgumentException - if timeout is negative
        java.lang.IllegalArgumentException - if timeout is > 0 and timeoutUnit is null
    • Method Detail

      • getConsistency

        public Consistency getConsistency()
        Gets the consistency used for a read operation. If null, the default consistency is used.
        Returns:
        the consistency used for a read operation
      • getTimeout

        public long getTimeout()
        Gets the timeout, which 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.
        Returns:
        the timeout
      • getTimeoutUnit

        public java.util.concurrent.TimeUnit getTimeoutUnit()
        Gets the unit of the timeout parameter, and may be null only if getTimeout() returns zero.
        Returns:
        the timeout unit or null