org.apache.accumulo.core.client
Class BatchWriterConfig

java.lang.Object
  extended by org.apache.accumulo.core.client.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 Summary
BatchWriterConfig()
           
 
Method Summary
 boolean equals(Object o)
           
 long getMaxLatency(TimeUnit timeUnit)
           
 long getMaxMemory()
           
 int getMaxWriteThreads()
           
 long getTimeout(TimeUnit timeUnit)
           
 int hashCode()
           
 void readFields(DataInput in)
           
 BatchWriterConfig setMaxLatency(long maxLatency, TimeUnit timeUnit)
          Sets the maximum amount of time to hold the data in memory before flushing it to servers.
For no maximum, set to zero, or Long.MAX_VALUE with TimeUnit.MILLISECONDS.
 BatchWriterConfig setMaxMemory(long maxMemory)
          Sets the maximum memory to batch before writing.
 BatchWriterConfig setMaxWriteThreads(int maxWriteThreads)
          Sets the maximum number of threads to use for writing data to the tablet servers.
 BatchWriterConfig setTimeout(long timeout, TimeUnit timeUnit)
          Sets the maximum amount of time an unresponsive server will be re-tried.
 String toString()
           
 void write(DataOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

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

setMaxLatency

public BatchWriterConfig setMaxLatency(long maxLatency,
                                       TimeUnit timeUnit)
Sets the maximum amount of time to hold the data in memory before flushing it to servers.
For no maximum, set to zero, or Long.MAX_VALUE with TimeUnit.MILLISECONDS.

TimeUnit.MICROSECONDS or TimeUnit.NANOSECONDS will be truncated to the nearest TimeUnit.MILLISECONDS.
If this truncation would result in making the value zero when it was specified as non-zero, then a minimum value of one TimeUnit.MILLISECONDS will be used.

Default: 120 seconds

Parameters:
maxLatency - the maximum latency, in the unit specified by the value of timeUnit
timeUnit - determines how maxLatency will be interpreted
Returns:
this to allow chaining of set methods
Throws:
IllegalArgumentException - if maxLatency is less than 0

setTimeout

public BatchWriterConfig setTimeout(long timeout,
                                    TimeUnit timeUnit)
Sets the maximum amount of time an unresponsive server will be re-tried. When this timeout is exceeded, the BatchWriter should throw an exception.
For no timeout, set to zero, or Long.MAX_VALUE with TimeUnit.MILLISECONDS.

TimeUnit.MICROSECONDS or TimeUnit.NANOSECONDS will be truncated to the nearest TimeUnit.MILLISECONDS.
If this truncation would result in making the value zero when it was specified as non-zero, then a minimum value of one TimeUnit.MILLISECONDS will be used.

Default: Long.MAX_VALUE (no timeout)

Parameters:
timeout - the timeout, in the unit specified by the value of timeUnit
timeUnit - determines how timeout will be interpreted
Returns:
this to allow chaining of set methods
Throws:
IllegalArgumentException - if timeout 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()

write

public void write(DataOutput out)
           throws IOException
Specified by:
write in interface org.apache.hadoop.io.Writable
Throws:
IOException

readFields

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

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2015 Apache Accumulo Project. All rights reserved.