@InterfaceAudience.Private public class ConnectionUtils extends Object
Modifier and Type | Class and Description |
---|---|
(package private) static class |
ConnectionUtils.MasterlessConnection
Some tests shut down the master.
|
Constructor and Description |
---|
ConnectionUtils() |
Modifier and Type | Method and Description |
---|---|
static ClusterConnection |
createShortCircuitConnection(org.apache.hadoop.conf.Configuration conf,
ExecutorService pool,
User user,
ServerName serverName,
org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin,
org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client)
Creates a short-circuit connection that can bypass the RPC layer (serialization,
deserialization, networking, etc..) when talking to a local server.
|
static ClusterConnection |
createShortCircuitHConnection(Connection conn,
ServerName serverName,
org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin,
org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client)
Deprecated.
|
static long |
getPauseTime(long pause,
int tries)
Calculate pause time.
|
static NonceGenerator |
injectNonceGeneratorForTesting(ClusterConnection conn,
NonceGenerator cnm) |
static void |
setServerSideHConnectionRetriesConfig(org.apache.hadoop.conf.Configuration c,
String sn,
org.apache.commons.logging.Log log)
Changes the configuration to set the number of retries needed when using HConnection
internally, e.g.
|
static void |
setupMasterlessConnection(org.apache.hadoop.conf.Configuration conf)
Setup the connection class, so that it will not depend on master being online.
|
private static final Random RANDOM
public static long getPauseTime(long pause, int tries)
HConstants.RETRY_BACKOFF
.pause
- tries
- tries
retriespublic static NonceGenerator injectNonceGeneratorForTesting(ClusterConnection conn, NonceGenerator cnm)
conn
- The connection for which to replace the generator.cnm
- Replaces the nonce generator used, for testing.public static void setServerSideHConnectionRetriesConfig(org.apache.hadoop.conf.Configuration c, String sn, org.apache.commons.logging.Log log)
c
- The Configuration instance to set the retries into.log
- Used to log what we set in here.@Deprecated public static ClusterConnection createShortCircuitHConnection(Connection conn, ServerName serverName, org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client)
conn
- the connection to adaptserverName
- the local server nameadmin
- the admin interface of the local serverclient
- the client interface of the local serverpublic static ClusterConnection createShortCircuitConnection(org.apache.hadoop.conf.Configuration conf, ExecutorService pool, User user, ServerName serverName, org.apache.hadoop.hbase.protobuf.generated.AdminProtos.AdminService.BlockingInterface admin, org.apache.hadoop.hbase.protobuf.generated.ClientProtos.ClientService.BlockingInterface client) throws IOException
conf
- the current configurationpool
- the thread pool to use for batch operationsuser
- the user the connection is forserverName
- the local server nameadmin
- the admin interface of the local serverclient
- the client interface of the local serverIOException
public static void setupMasterlessConnection(org.apache.hadoop.conf.Configuration conf)
conf
- configuration to setCopyright © 2007–2019 The Apache Software Foundation. All rights reserved.