public interface BatchWriter extends AutoCloseable
When the user uses a Connector to create a BatchWriter, they specify how much memory and how many threads it should use. As the user adds mutations to the batch writer, it buffers them. Once the buffered mutations have used half of the user specified buffer, the mutations are dumped into the background to be written by a thread pool. If the user specified memory completely fills up, then writes are held. When a user calls flush, it does not return until all buffered mutations are written.
In the event that an MutationsRejectedException exception is thrown by one of the methods on a BatchWriter instance, the user should close the current instance and create a new instance. This is a known limitation which will be addressed by ACCUMULO-2990 in the future.
Modifier and Type | Method and Description |
---|---|
void |
addMutation(Mutation m)
Queues one mutation to write.
|
void |
addMutations(Iterable<Mutation> iterable)
Queues several mutations to write.
|
void |
close()
Flush and release any resources.
|
void |
flush()
Send any buffered mutations to Accumulo immediately.
|
void addMutation(Mutation m) throws MutationsRejectedException
m
- the mutation to addMutationsRejectedException
- this could be thrown because current or previous mutations failedvoid addMutations(Iterable<Mutation> iterable) throws MutationsRejectedException
iterable
- allows adding any number of mutations iterativelyMutationsRejectedException
- this could be thrown because current or previous mutations failedvoid flush() throws MutationsRejectedException
MutationsRejectedException
- this could be thrown because current or previous mutations failedvoid close() throws MutationsRejectedException
close
in interface AutoCloseable
MutationsRejectedException
- this could be thrown because current or previous mutations failedCopyright © 2011–2017 The Apache Software Foundation. All rights reserved.