public abstract class AbstractRemoteConnection extends Object implements RemoteConnection, EncryptionContext
| Constructor and Description |
|---|
AbstractRemoteConnection(io.netty.channel.socket.SocketChannel channel,
String name,
EncryptionContext encryptionContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
addSecurityHandlers()
Helps to add all the required security handler's after negotiation for encryption is completed.
|
boolean |
blockOnNotWritable(RpcOutcomeListener<?> listener) |
void |
channelClosed(RpcException ex)
Called from the RpcBus's channel close handler to close all remaining
resources associated with this connection.
|
void |
close()
Connection consumer wants to close connection.
|
<V> ChannelListenerWithCoordinationId |
createNewRpcListener(RpcOutcomeListener<V> handler,
Class<V> clazz)
Create a new rpc listener that will be notified when the response is returned.
|
abstract void |
decConnectionCounter() |
<V> RpcOutcome<V> |
getAndRemoveRpcOutcome(int rpcType,
int coordinationId,
Class<V> clazz)
For incoming messages, remove the outcome listener and return it.
|
io.netty.channel.Channel |
getChannel() |
String |
getEncryptionCtxtString() |
int |
getMaxWrappedSize() |
String |
getName() |
SocketAddress |
getRemoteAddress() |
int |
getWrapSizeLimit() |
abstract void |
incConnectionCounter() |
boolean |
inEventLoop() |
boolean |
isActive() |
boolean |
isEncryptionEnabled() |
void |
recordRemoteFailure(int coordinationId,
UserBitShared.DrillPBError failure)
Inform the local outcome listener that the remote operation could not be handled.
|
void |
setAutoRead(boolean enableAutoRead) |
void |
setEncryption(boolean encrypted) |
void |
setMaxWrappedSize(int maxWrappedChunkSize) |
void |
setWrapSizeLimit(int wrapSizeLimit) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetAllocatorprotected SaslCodec saslCodec
public AbstractRemoteConnection(io.netty.channel.socket.SocketChannel channel,
String name,
EncryptionContext encryptionContext)
public boolean inEventLoop()
inEventLoop in interface RemoteConnectionpublic String getName()
getName in interface RemoteConnectionpublic final io.netty.channel.Channel getChannel()
getChannel in interface RemoteConnectionpublic boolean blockOnNotWritable(RpcOutcomeListener<?> listener)
blockOnNotWritable in interface RemoteConnectionpublic void setAutoRead(boolean enableAutoRead)
setAutoRead in interface ConnectionThrottlepublic boolean isActive()
isActive in interface RemoteConnectionpublic <V> RpcOutcome<V> getAndRemoveRpcOutcome(int rpcType, int coordinationId, Class<V> clazz)
getAndRemoveRpcOutcome in interface RemoteConnectionrpcType - The rpc type associated with the coordination.coordinationId - The coordination id that was returned with the listener was created.clazz - The class that is expected in response.public <V> ChannelListenerWithCoordinationId createNewRpcListener(RpcOutcomeListener<V> handler, Class<V> clazz)
createNewRpcListener in interface RemoteConnectionhandler - The outcome handler to be notified when the response arrives.clazz - The Class associated with the response object.public void recordRemoteFailure(int coordinationId,
UserBitShared.DrillPBError failure)
recordRemoteFailure in interface RemoteConnectioncoordinationId - The id that failed.failure - The failure that occurred.public void channelClosed(RpcException ex)
channelClosed in interface RemoteConnectionex - The exception that caused the channel to close.public SocketAddress getRemoteAddress()
getRemoteAddress in interface RemoteConnectionpublic void close()
The check for isActive is not required here since channel can be in OPEN state without being active. We want to close in both the scenarios. A channel is in OPEN state when a socket is created for it before binding to an address.
close in interface AutoCloseableclose in interface RemoteConnectionpublic void addSecurityHandlers()
Handler's before encryption is negotiated are:
ProtobufLengthDecoder RpcDecoder RpcEncoder BasicClient.ClientHandshakeHandler OR
BasicServer.ServerHandshakeHandler BasicClient.IdlePingHandler OR
- TIMEOUT_HANDLER BasicServer.LoggingReadTimeoutHandler RpcBus.InboundHandler RpcExceptionHandler Handler's after encryption is negotiated are:
LengthFieldBasedFrameDecoder
SaslDecryptionHandler
ProtobufLengthDecoder
RpcDecoder
SaslEncryptionHandler
ChunkCreationHandler
RpcEncoder
BasicClient.ClientHandshakeHandler OR
BasicServer.ServerHandshakeHandler
BasicClient.IdlePingHandler OR
- TIMEOUT_HANDLER BasicServer.LoggingReadTimeoutHandler
RpcBus.InboundHandler
RpcExceptionHandler
If encryption is enabled ChunkCreationHandler is always added to divide the Rpc message into chunks of
negotiated EncryptionContextImpl.wrapSizeLimit bytes. This helps to make a generic encryption handler.
addSecurityHandlers in interface RemoteConnectionpublic abstract void incConnectionCounter()
public abstract void decConnectionCounter()
public void setEncryption(boolean encrypted)
setEncryption in interface EncryptionContextpublic boolean isEncryptionEnabled()
isEncryptionEnabled in interface EncryptionContextpublic String getEncryptionCtxtString()
getEncryptionCtxtString in interface EncryptionContextpublic void setMaxWrappedSize(int maxWrappedChunkSize)
setMaxWrappedSize in interface EncryptionContextpublic int getMaxWrappedSize()
getMaxWrappedSize in interface EncryptionContextpublic void setWrapSizeLimit(int wrapSizeLimit)
setWrapSizeLimit in interface EncryptionContextpublic int getWrapSizeLimit()
getWrapSizeLimit in interface EncryptionContextCopyright © 2019 The Apache Software Foundation. All rights reserved.