@InterfaceAudience.Private public class ConnectionUtils extends Object
Constructor and Description |
---|
ConnectionUtils() |
Modifier and Type | Method and Description |
---|---|
static long |
addJitter(long pause,
float jitter)
Adds / subs a 10% jitter to a pause time.
|
static ClusterConnection |
createShortCircuitConnection(org.apache.hadoop.conf.Configuration conf,
ExecutorService pool,
User user,
ServerName serverName,
AdminProtos.AdminService.BlockingInterface admin,
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,
AdminProtos.AdminService.BlockingInterface admin,
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.
|
public static long getPauseTime(long pause, int tries)
HConstants.RETRY_BACKOFF
.pause
- tries
- tries
retriespublic static long addJitter(long pause, float jitter)
pause
- the expected pause.jitter
- the jitter ratio, between 0 and 1, exclusive.public 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, AdminProtos.AdminService.BlockingInterface admin, 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, AdminProtos.AdminService.BlockingInterface admin, 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-2016 The Apache Software Foundation. All Rights Reserved.