@InterfaceAudience.Private class BlockingRpcConnection extends RpcConnection implements Runnable
Modifier and Type | Class and Description |
---|---|
private class |
BlockingRpcConnection.CallSender
If the client wants to interrupt its calls easily (i.e.
|
Modifier and Type | Field and Description |
---|---|
private ConcurrentMap<Integer,Call> |
calls |
private BlockingRpcConnection.CallSender |
callSender |
private boolean |
closed |
private byte[] |
connectionHeaderPreamble |
private byte[] |
connectionHeaderWithLength |
private DataInputStream |
in |
private static org.slf4j.Logger |
LOG |
private DataOutputStream |
out |
private BlockingRpcClient |
rpcClient |
private HBaseSaslRpcClient |
saslRpcClient |
protected Socket |
socket |
private Thread |
thread |
private String |
threadName |
private boolean |
waitingConnectionHeaderResponse |
codec, compressor, conf, CRYPTO_AES_ENABLED_DEFAULT, CRYPTO_AES_ENABLED_KEY, lastTouched, provider, reloginMaxBackoff, remoteId, securityInfo, serverAddress, timeoutTimer, token, useSasl
Constructor and Description |
---|
BlockingRpcConnection(BlockingRpcClient rpcClient,
ConnectionId remoteId) |
Modifier and Type | Method and Description |
---|---|
protected void |
callTimeout(Call call) |
void |
cleanupConnection()
Does the clean up work after the connection is removed from the connection pool
|
private void |
closeConn(IOException e) |
private void |
closeSocket() |
private void |
disposeSasl() |
private void |
handleConnectionFailure(int curRetries,
int maxRetries,
IOException ioe)
Handle connection failures If the current number of retries is equal to the max number of
retries, stop retrying and throw the exception; Otherwise backoff N seconds and try connecting
again.
|
private void |
handleSaslConnectionFailure(int currRetries,
int maxRetries,
Exception ex,
org.apache.hadoop.security.UserGroupInformation user)
If multiple clients with the same principal try to connect to the same server at the same time,
the server assumes a replay attack is in progress.
|
boolean |
isActive()
Tell the idle connection sweeper whether we could be swept.
|
private void |
negotiateCryptoAes(org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.CryptoCipherMeta cryptoCipherMeta) |
private void |
processResponseForConnectionHeader() |
private void |
readResponse() |
void |
run() |
void |
sendRequest(Call call,
HBaseRpcController pcrc) |
protected void |
setupConnection() |
private void |
setupIOstreams() |
private boolean |
setupSaslConnection(InputStream in2,
OutputStream out2) |
void |
shutdown()
Just close connection.
|
private void |
tracedWriteRequest(Call call) |
private boolean |
waitForWork() |
private void |
writeConnectionHeader()
Write the connection header.
|
private void |
writeConnectionHeaderPreamble(OutputStream out)
Write the RPC header:
<MAGIC WORD -- 'HBas'> <ONEBYTE_VERSION> <ONEBYTE_AUTH_TYPE> |
private void |
writeRequest(Call call)
Initiates a call by sending the parameter to the remote server.
|
getConnectionHeader, getConnectionHeaderPreamble, getLastTouched, remoteId, scheduleTimeoutTask, setLastTouched
private static final org.slf4j.Logger LOG
private final BlockingRpcClient rpcClient
private final String threadName
private DataInputStream in
private DataOutputStream out
private HBaseSaslRpcClient saslRpcClient
private final ConcurrentMap<Integer,Call> calls
private final BlockingRpcConnection.CallSender callSender
private boolean closed
private byte[] connectionHeaderPreamble
private byte[] connectionHeaderWithLength
private boolean waitingConnectionHeaderResponse
BlockingRpcConnection(BlockingRpcClient rpcClient, ConnectionId remoteId) throws IOException
IOException
protected void setupConnection() throws IOException
IOException
private void handleConnectionFailure(int curRetries, int maxRetries, IOException ioe) throws IOException
curRetries
- current number of retriesmaxRetries
- max number of retries allowedioe
- failure reasonIOException
- if max number of retries is reachedprivate boolean waitForWork()
private void disposeSasl()
private boolean setupSaslConnection(InputStream in2, OutputStream out2) throws IOException
IOException
private void handleSaslConnectionFailure(int currRetries, int maxRetries, Exception ex, org.apache.hadoop.security.UserGroupInformation user) throws IOException, InterruptedException
The retry logic is governed by the SaslClientAuthenticationProvider.canRetry()
method. Some providers have the ability to obtain new credentials and then re-attempt to
authenticate with HBase services. Other providers will continue to fail if they failed the
first time -- for those, we want to fail-fast.
IOException
InterruptedException
private void setupIOstreams() throws IOException
IOException
private void writeConnectionHeaderPreamble(OutputStream out) throws IOException
<MAGIC WORD -- 'HBas'> <ONEBYTE_VERSION> <ONEBYTE_AUTH_TYPE>
IOException
private void writeConnectionHeader() throws IOException
IOException
private void processResponseForConnectionHeader() throws IOException
IOException
private void negotiateCryptoAes(org.apache.hadoop.hbase.shaded.protobuf.generated.RPCProtos.CryptoCipherMeta cryptoCipherMeta) throws IOException
IOException
private void tracedWriteRequest(Call call) throws IOException
IOException
private void writeRequest(Call call) throws IOException
IOException
readResponse()
private void readResponse()
protected void callTimeout(Call call)
callTimeout
in class RpcConnection
private void closeSocket()
private void closeConn(IOException e)
public void shutdown()
RpcConnection
shutdown
in class RpcConnection
public void cleanupConnection()
RpcConnection
cleanupConnection
in class RpcConnection
public void sendRequest(Call call, HBaseRpcController pcrc) throws IOException
sendRequest
in class RpcConnection
IOException
public boolean isActive()
RpcConnection
isActive
in class RpcConnection
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.