Class MockBufferedMutator
- java.lang.Object
-
- org.apache.hadoop.hbase.client.mock.MockBufferedMutator
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,org.apache.hadoop.hbase.client.BufferedMutator
public class MockBufferedMutator extends Object implements org.apache.hadoop.hbase.client.BufferedMutator
-
-
Constructor Summary
Constructors Constructor Description MockBufferedMutator(org.apache.hadoop.hbase.client.Connection conn, org.apache.hadoop.hbase.TableName name, org.apache.hadoop.conf.Configuration config)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Performs aflush()
and releases any resources held.void
flush()
Executes all the buffered, asynchronousMutation
operations and waits until they are done.org.apache.hadoop.conf.Configuration
getConfiguration()
Returns theConfiguration
object used by this instance.org.apache.hadoop.hbase.TableName
getName()
Gets the fully qualified table name instance of the table that this BufferedMutator writes to.long
getWriteBufferSize()
Returns the maximum size in bytes of the write buffer for this HTable.void
mutate(List<? extends org.apache.hadoop.hbase.client.Mutation> ms)
Send someMutation
s to the table.void
mutate(org.apache.hadoop.hbase.client.Mutation mutation)
Sends aMutation
to the table.void
setOperationTimeout(int timeout)
void
setRpcTimeout(int timeout)
-
-
-
Method Detail
-
getName
public org.apache.hadoop.hbase.TableName getName()
Gets the fully qualified table name instance of the table that this BufferedMutator writes to.- Specified by:
getName
in interfaceorg.apache.hadoop.hbase.client.BufferedMutator
-
getConfiguration
public org.apache.hadoop.conf.Configuration getConfiguration()
Returns theConfiguration
object used by this instance.The reference returned is not a copy, so any change made to it will affect this instance.
- Specified by:
getConfiguration
in interfaceorg.apache.hadoop.hbase.client.BufferedMutator
-
mutate
public void mutate(org.apache.hadoop.hbase.client.Mutation mutation)
Sends aMutation
to the table. The mutations will be buffered and sent over the wire as part of a batch. Currently only supportsPut
andDelete
mutations.- Specified by:
mutate
in interfaceorg.apache.hadoop.hbase.client.BufferedMutator
- Parameters:
mutation
- The data to send.
-
mutate
public void mutate(List<? extends org.apache.hadoop.hbase.client.Mutation> ms) throws IOException
Send someMutation
s to the table. The mutations will be buffered and sent over the wire as part of a batch. There is no guarantee of sending entire content ofmutations
in a single batch; it will be broken up according to the write buffer capacity.- Specified by:
mutate
in interfaceorg.apache.hadoop.hbase.client.BufferedMutator
- Parameters:
ms
- The data to send.- Throws:
IOException
- if a remote or network exception occurs.
-
close
public void close() throws IOException
Performs aflush()
and releases any resources held.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceorg.apache.hadoop.hbase.client.BufferedMutator
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
- if a remote or network exception occurs.
-
flush
public void flush() throws IOException
Executes all the buffered, asynchronousMutation
operations and waits until they are done.- Specified by:
flush
in interfaceorg.apache.hadoop.hbase.client.BufferedMutator
- Throws:
IOException
- if a remote or network exception occurs.
-
getWriteBufferSize
public long getWriteBufferSize()
Returns the maximum size in bytes of the write buffer for this HTable.The default value comes from the configuration parameter
hbase.client.write.buffer
.- Specified by:
getWriteBufferSize
in interfaceorg.apache.hadoop.hbase.client.BufferedMutator
- Returns:
- The size of the write buffer in bytes.
-
setRpcTimeout
public void setRpcTimeout(int timeout)
- Specified by:
setRpcTimeout
in interfaceorg.apache.hadoop.hbase.client.BufferedMutator
-
setOperationTimeout
public void setOperationTimeout(int timeout)
- Specified by:
setOperationTimeout
in interfaceorg.apache.hadoop.hbase.client.BufferedMutator
-
-