@InterfaceAudience.Private public class MultiHConnection extends Object
Modifier and Type | Field and Description |
---|---|
private ExecutorService |
batchPool |
private HConnection[] |
hConnections |
private Object |
hConnectionsLock |
private static org.apache.commons.logging.Log |
LOG |
private int |
noOfConnections |
Constructor and Description |
---|
MultiHConnection(org.apache.hadoop.conf.Configuration conf,
int noOfConnections)
Create multiple HConnection instances and initialize a thread pool executor
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the open connections and shutdown the batchpool
|
private 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
|
private static final org.apache.commons.logging.Log LOG
private HConnection[] hConnections
private final Object hConnectionsLock
private int noOfConnections
private ExecutorService batchPool
public MultiHConnection(org.apache.hadoop.conf.Configuration conf, int noOfConnections) throws IOException
conf
- configurationnoOfConnections
- total no of HConnections to createIOException
public void close()
public <R> void processBatchCallback(List<? extends Row> actions, TableName tableName, Object[] results, Batch.Callback<R> callback) throws IOException
actions
- the actionstableName
- table nameresults
- the results arraycallback
- IOException
private void createBatchPool(org.apache.hadoop.conf.Configuration conf)
Copyright © 2007–2019 The Apache Software Foundation. All rights reserved.