org.apache.accumulo.core.client
Interface BatchWriter

All Known Implementing Classes:
BatchWriterImpl, MockBatchWriter

public interface BatchWriter

Send Mutations to a single Table in Accumulo. 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.


Method Summary
 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.
 

Method Detail

addMutation

void addMutation(Mutation m)
                 throws MutationsRejectedException
Queues one mutation to write.

Parameters:
m - the mutation to add
Throws:
MutationsRejectedException - this could be thrown because current or previous mutations failed

addMutations

void addMutations(Iterable<Mutation> iterable)
                  throws MutationsRejectedException
Queues several mutations to write.

Parameters:
iterable - allows adding any number of mutations iteratively
Throws:
MutationsRejectedException - this could be thrown because current or previous mutations failed

flush

void flush()
           throws MutationsRejectedException
Send any buffered mutations to Accumulo immediately.

Throws:
MutationsRejectedException - this could be thrown because current or previous mutations failed

close

void close()
           throws MutationsRejectedException
Flush and release any resources.

Throws:
MutationsRejectedException - this could be thrown because current or previous mutations failed


Copyright © 2015 Apache Accumulo Project. All rights reserved.