@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 |
createShortCircuitHConnection(Connection conn,
ServerName serverName,
AdminProtos.AdminService.BlockingInterface admin,
ClientProtos.ClientService.BlockingInterface client)
Adapt a HConnection so that it can bypass the RPC layer (serialization,
deserialization, networking, etc..) -- i.e.
|
static long |
getPauseTime(long pause,
int tries)
Calculate pause time.
|
static NonceGenerator |
injectNonceGeneratorForTesting(ClusterConnection conn,
NonceGenerator cnm) |
static void |
setServerSideHConnectionRetriesConfig(Configuration c,
String sn,
Log log)
Changes the configuration to set the number of retries needed when using HConnection
internally, e.g.
|
static void |
setupMasterlessConnection(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(Configuration c, String sn, Log log)
c
- The Configuration instance to set the retries into.log
- Used to log what we set in here.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 void setupMasterlessConnection(Configuration conf)
conf
- configuration to set