Class BatchWriterConfig

  • All Implemented Interfaces:
    org.apache.hadoop.io.Writable

    public class BatchWriterConfig
    extends Object
    implements org.apache.hadoop.io.Writable
    This object holds configuration settings used to instantiate a BatchWriter
    Since:
    1.5.0
    • Constructor Detail

      • BatchWriterConfig

        public BatchWriterConfig()
    • Method Detail

      • setMaxMemory

        public BatchWriterConfig setMaxMemory​(long maxMemory)
        Sets the maximum memory to batch before writing. The smaller this value, the more frequently the BatchWriter will write.
        If set to a value smaller than a single mutation, then it will BatchWriter.flush() after each added mutation. Must be non-negative.

        Default: 50M

        Parameters:
        maxMemory - max size in bytes
        Returns:
        this to allow chaining of set methods
        Throws:
        IllegalArgumentException - if maxMemory is less than 0
      • setMaxWriteThreads

        public BatchWriterConfig setMaxWriteThreads​(int maxWriteThreads)
        Sets the maximum number of threads to use for writing data to the tablet servers.

        Default: 3

        Parameters:
        maxWriteThreads - the maximum threads to use
        Returns:
        this to allow chaining of set methods
        Throws:
        IllegalArgumentException - if maxWriteThreads is non-positive
      • getMaxMemory

        public long getMaxMemory()
      • getMaxLatency

        public long getMaxLatency​(TimeUnit timeUnit)
      • getTimeout

        public long getTimeout​(TimeUnit timeUnit)
      • getMaxWriteThreads

        public int getMaxWriteThreads()
      • getDurability

        public Durability getDurability()
        Returns:
        the durability to be used by the BatchWriter
        Since:
        1.7.0
      • setDurability

        public BatchWriterConfig setDurability​(Durability durability)
        Change the durability for the BatchWriter session. The default durability is "default" which is the table's durability setting. If the durability is set to something other than the default, it will override the durability setting of the table.
        Parameters:
        durability - the Durability to be used by the BatchWriter
        Since:
        1.7.0
      • readFields

        public void readFields​(DataInput in)
                        throws IOException
        Specified by:
        readFields in interface org.apache.hadoop.io.Writable
        Throws:
        IOException
      • merge

        public BatchWriterConfig merge​(BatchWriterConfig other)
        Merge this BatchWriterConfig with another. If config is set in both, preference will be given to this config.
        Parameters:
        other - Another BatchWriterConfig
        Returns:
        Merged BatchWriterConfig
        Since:
        2.0.0
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object