@InterfaceAudience.Private public final class ConnectionUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ConnectionUtils.ShortCircuitingClusterConnection
A ClusterConnection that will short-circuit RPC making direct invocations against the localhost
if the invocation target is 'this' server; save on network and protobuf invocations.
|
Modifier and Type | Method and Description |
---|---|
static org.apache.hadoop.hbase.client.ScanResultCache |
createScanResultCache(Scan scan) |
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 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.slf4j.Logger log)
Changes the configuration to set the number of retries needed when using Connection 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
- time to pausetries
- amount of triestries
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.slf4j.Logger log)
c
- The Configuration instance to set the retries into.log
- Used to log what we set in here.public 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
- if IO failure occurredpublic static void setupMasterlessConnection(org.apache.hadoop.conf.Configuration conf)
conf
- configuration to setpublic static org.apache.hadoop.hbase.client.ScanResultCache createScanResultCache(Scan scan)
Copyright © 2007–2019 Cloudera. All rights reserved.