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, wait
getAllocator
protected SaslCodec saslCodec
public AbstractRemoteConnection(io.netty.channel.socket.SocketChannel channel, String name, EncryptionContext encryptionContext)
public boolean inEventLoop()
inEventLoop
in interface RemoteConnection
public String getName()
getName
in interface RemoteConnection
public final io.netty.channel.Channel getChannel()
getChannel
in interface RemoteConnection
public boolean blockOnNotWritable(RpcOutcomeListener<?> listener)
blockOnNotWritable
in interface RemoteConnection
public void setAutoRead(boolean enableAutoRead)
setAutoRead
in interface ConnectionThrottle
public boolean isActive()
isActive
in interface RemoteConnection
public <V> RpcOutcome<V> getAndRemoveRpcOutcome(int rpcType, int coordinationId, Class<V> clazz)
getAndRemoveRpcOutcome
in interface RemoteConnection
rpcType
- 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 RemoteConnection
handler
- 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 RemoteConnection
coordinationId
- The id that failed.failure
- The failure that occurred.public void channelClosed(RpcException ex)
channelClosed
in interface RemoteConnection
ex
- The exception that caused the channel to close.public SocketAddress getRemoteAddress()
getRemoteAddress
in interface RemoteConnection
public 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 AutoCloseable
close
in interface RemoteConnection
public void addSecurityHandlers()
Handler's before encryption is negotiated are:
ProtobufLengthDecoder
RpcDecoder
RpcEncoder
BasicClient.ClientHandshakeHandler
OR
BasicServer.ServerHandshakeHandler
org.apache.drill.exec.rpc.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
org.apache.drill.exec.rpc.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 RemoteConnection
public abstract void incConnectionCounter()
public abstract void decConnectionCounter()
public void setEncryption(boolean encrypted)
setEncryption
in interface EncryptionContext
public boolean isEncryptionEnabled()
isEncryptionEnabled
in interface EncryptionContext
public String getEncryptionCtxtString()
getEncryptionCtxtString
in interface EncryptionContext
public void setMaxWrappedSize(int maxWrappedChunkSize)
setMaxWrappedSize
in interface EncryptionContext
public int getMaxWrappedSize()
getMaxWrappedSize
in interface EncryptionContext
public void setWrapSizeLimit(int wrapSizeLimit)
setWrapSizeLimit
in interface EncryptionContext
public int getWrapSizeLimit()
getWrapSizeLimit
in interface EncryptionContext
Copyright © 1970 The Apache Software Foundation. All rights reserved.