Package org.apache.hadoop.hbase.util
Class MultiHConnection
java.lang.Object
org.apache.hadoop.hbase.util.MultiHConnection
Provides ability to create multiple Connection instances and allows to process a batch of actions
using CHTable.doBatchWithCallback()
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate ExecutorServiceprivate Connection[]private final Objectprivate static final org.slf4j.Loggerprivate final int -
Constructor Summary
ConstructorsConstructorDescriptionMultiHConnection(org.apache.hadoop.conf.Configuration conf, int noOfConnections) Create multiple Connection instances and initialize a thread pool executor -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Close the open connections and shutdown the batchpoolprivate voidcreateBatchPool(org.apache.hadoop.conf.Configuration conf) <R> voidprocessBatchCallback(List<? extends Row> actions, TableName tableName, Object[] results, Batch.Callback<R> callback) Randomly pick a connection and process the batch of actions for a given table
-
Field Details
-
LOG
-
connections
-
connectionsLock
-
noOfConnections
-
batchPool
-
-
Constructor Details
-
MultiHConnection
public MultiHConnection(org.apache.hadoop.conf.Configuration conf, int noOfConnections) throws IOException Create multiple Connection instances and initialize a thread pool executor- Parameters:
conf- configurationnoOfConnections- total no of Connections to create- Throws:
IOException- if IO failure occurs
-
-
Method Details
-
close
Close the open connections and shutdown the batchpool -
processBatchCallback
public <R> void processBatchCallback(List<? extends Row> actions, TableName tableName, Object[] results, Batch.Callback<R> callback) throws IOException Randomly pick a connection and process the batch of actions for a given table- Parameters:
actions- the actionstableName- table nameresults- the results arraycallback- to run when results are in- Throws:
IOException- If IO failure occurs
-
createBatchPool
-