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
Modifier and TypeFieldDescriptionprivate ExecutorService
private Connection[]
private final Object
private static final org.slf4j.Logger
private final int
-
Constructor Summary
ConstructorDescriptionMultiHConnection
(org.apache.hadoop.conf.Configuration conf, int noOfConnections) Create multiple Connection instances and initialize a thread pool executor -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the open connections and shutdown the batchpoolprivate void
createBatchPool
(org.apache.hadoop.conf.Configuration conf) <R> void
processBatchCallback
(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
-