Package org.apache.accumulo.core.client
Class BatchWriterConfig
- java.lang.Object
-
- 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 aBatchWriter- Since:
- 1.5.0
-
-
Constructor Summary
Constructors Constructor Description BatchWriterConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)DurabilitygetDurability()longgetMaxLatency(TimeUnit timeUnit)longgetMaxMemory()intgetMaxWriteThreads()longgetTimeout(TimeUnit timeUnit)inthashCode()voidreadFields(DataInput in)BatchWriterConfigsetDurability(Durability durability)Change the durability for the BatchWriter session.BatchWriterConfigsetMaxLatency(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, orLong.MAX_VALUEwithTimeUnit.MILLISECONDS.BatchWriterConfigsetMaxMemory(long maxMemory)Sets the maximum memory to batch before writing.BatchWriterConfigsetMaxWriteThreads(int maxWriteThreads)Sets the maximum number of threads to use for writing data to the tablet servers.BatchWriterConfigsetTimeout(long timeout, TimeUnit timeUnit)Sets the maximum amount of time an unresponsive server will be re-tried.StringtoString()voidwrite(DataOutput out)
-
-
-
Method Detail
-
setMaxMemory
public BatchWriterConfig setMaxMemory(long maxMemory)
Sets the maximum memory to batch before writing. The smaller this value, the more frequently theBatchWriterwill write.
If set to a value smaller than a single mutation, then it willBatchWriter.flush()after each added mutation. Must be non-negative.Default: 50M
- Parameters:
maxMemory- max size in bytes- Returns:
thisto allow chaining of set methods- Throws:
IllegalArgumentException- ifmaxMemoryis 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, orLong.MAX_VALUEwithTimeUnit.MILLISECONDS.TimeUnit.MICROSECONDSorTimeUnit.NANOSECONDSwill be truncated to the nearestTimeUnit.MILLISECONDS.
If this truncation would result in making the value zero when it was specified as non-zero, then a minimum value of oneTimeUnit.MILLISECONDSwill be used.Default: 120 seconds
- Parameters:
maxLatency- the maximum latency, in the unit specified by the value oftimeUnittimeUnit- determines howmaxLatencywill be interpreted- Returns:
thisto allow chaining of set methods- Throws:
IllegalArgumentException- ifmaxLatencyis 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, theBatchWritershould throw an exception.
For no timeout, set to zero, orLong.MAX_VALUEwithTimeUnit.MILLISECONDS.TimeUnit.MICROSECONDSorTimeUnit.NANOSECONDSwill be truncated to the nearestTimeUnit.MILLISECONDS.
If this truncation would result in making the value zero when it was specified as non-zero, then a minimum value of oneTimeUnit.MILLISECONDSwill be used.Default:
Long.MAX_VALUE(no timeout)- Parameters:
timeout- the timeout, in the unit specified by the value oftimeUnittimeUnit- determines howtimeoutwill be interpreted- Returns:
thisto allow chaining of set methods- Throws:
IllegalArgumentException- iftimeoutis 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:
thisto allow chaining of set methods- Throws:
IllegalArgumentException- ifmaxWriteThreadsis 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
-
write
public void write(DataOutput out) throws IOException
- Specified by:
writein interfaceorg.apache.hadoop.io.Writable- Throws:
IOException
-
readFields
public void readFields(DataInput in) throws IOException
- Specified by:
readFieldsin interfaceorg.apache.hadoop.io.Writable- Throws:
IOException
-
-