T
- handshake rpc typeCC
- Client connection typeHS
- Handshake send typeHR
- Handshake receive typepublic abstract class BasicClient<T extends com.google.protobuf.Internal.EnumLite,CC extends ClientConnection,HS extends com.google.protobuf.MessageLite,HR extends com.google.protobuf.MessageLite> extends RpcBus<T,CC>
RpcBus.ChannelClosedHandler, RpcBus.InboundHandler
Modifier and Type | Field and Description |
---|---|
protected CC |
connection |
Constructor and Description |
---|
BasicClient(RpcConfig rpcMapping,
io.netty.buffer.ByteBufAllocator alloc,
io.netty.channel.EventLoopGroup eventLoopGroup,
T handshakeType,
Class<HR> responseClass,
com.google.protobuf.Parser<HR> handshakeParser) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
protected void |
connectAsClient(RpcConnectionHandler<CC> connectionListener,
HS handshakeValue,
String host,
int port) |
protected void |
finalizeConnection(HR handshake,
CC connection) |
abstract ProtobufLengthDecoder |
getDecoder(BufferAllocator allocator) |
boolean |
hasPing(long timeoutSec)
Sends request and waits for answer to verify connection.
|
protected CC |
initRemoteConnection(io.netty.channel.socket.SocketChannel channel) |
boolean |
isActive() |
protected boolean |
isAuthComplete() |
protected boolean |
isSslEnabled() |
protected abstract void |
prepareSaslHandshake(RpcConnectionHandler<CC> connectionHandler,
List<String> serverAuthMechanisms)
Creates various instances needed to start the SASL handshake.
|
<SEND extends com.google.protobuf.MessageLite,RECEIVE extends com.google.protobuf.MessageLite> |
send(RpcOutcomeListener<RECEIVE> listener,
SEND protobufBody,
boolean allowInEventLoop,
io.netty.buffer.ByteBuf... dataBodies) |
<SEND extends com.google.protobuf.MessageLite,RECEIVE extends com.google.protobuf.MessageLite> |
send(RpcOutcomeListener<RECEIVE> listener,
T rpcType,
SEND protobufBody,
Class<RECEIVE> clazz,
io.netty.buffer.ByteBuf... dataBodies) |
<SEND extends com.google.protobuf.MessageLite,RECEIVE extends com.google.protobuf.MessageLite> |
send(T rpcType,
SEND protobufBody,
Class<RECEIVE> clazz,
io.netty.buffer.ByteBuf... dataBodies) |
protected void |
setAuthComplete(boolean authComplete)
Set's the state for authentication complete.
|
void |
setAutoRead(boolean enableAutoRead) |
void |
setSslChannel(io.netty.channel.Channel c) |
protected void |
setupSSL(io.netty.channel.ChannelPipeline pipe,
ConnectionMultiListener.SSLHandshakeListener sslHandshakeListener) |
protected void |
startSaslHandshake(RpcConnectionHandler<CC> connectionHandler,
Map<String,?> saslProperties,
org.apache.hadoop.security.UserGroupInformation ugi,
AuthenticatorFactory authFactory,
T rpcType)
Main method which starts the SASL handshake for all client channels (user/data/control) once it's determined
after regular RPC handshake that authentication is required by server side.
|
protected abstract List<String> |
validateHandshake(HR validateHandshake) |
get, getCloseHandler, getResponseDefaultInstance, handle, send, send, send, setAddresses
protected CC extends ClientConnection connection
protected void setupSSL(io.netty.channel.ChannelPipeline pipe, ConnectionMultiListener.SSLHandshakeListener sslHandshakeListener)
protected boolean isSslEnabled()
protected void setAuthComplete(boolean authComplete)
authComplete
- - state to set. True means authentication between client and server is completed, false
means authentication is in progress.protected boolean isAuthComplete()
public void setSslChannel(io.netty.channel.Channel c)
protected CC initRemoteConnection(io.netty.channel.socket.SocketChannel channel)
initRemoteConnection
in class RpcBus<T extends com.google.protobuf.Internal.EnumLite,CC extends ClientConnection>
public boolean hasPing(long timeoutSec)
timeoutSec
- time in seconds to wait message receiving. If 0 then won't wait.public abstract ProtobufLengthDecoder getDecoder(BufferAllocator allocator)
public boolean isActive()
protected abstract List<String> validateHandshake(HR validateHandshake) throws RpcException
RpcException
protected abstract void prepareSaslHandshake(RpcConnectionHandler<CC> connectionHandler, List<String> serverAuthMechanisms) throws RpcException
validateHandshake(MessageLite)
if authentication is required from server side.connectionHandler
- - Connection handler used by client's to know about success/failure conditions.serverAuthMechanisms
- - List of auth mechanisms configured on server sideRpcException
protected void startSaslHandshake(RpcConnectionHandler<CC> connectionHandler, Map<String,?> saslProperties, org.apache.hadoop.security.UserGroupInformation ugi, AuthenticatorFactory authFactory, T rpcType)
connectionHandler
- - Connection handler used by client's to know about success/failure conditions.saslProperties
- - SASL related properties needed to create SASL client.ugi
- - UserGroupInformation with logged in client side userauthFactory
- - Authentication factory to use for this SASL handshake.rpcType
- - SASL_MESSAGE rpc type.public <SEND extends com.google.protobuf.MessageLite,RECEIVE extends com.google.protobuf.MessageLite> void send(RpcOutcomeListener<RECEIVE> listener, T rpcType, SEND protobufBody, Class<RECEIVE> clazz, io.netty.buffer.ByteBuf... dataBodies)
public <SEND extends com.google.protobuf.MessageLite,RECEIVE extends com.google.protobuf.MessageLite> DrillRpcFuture<RECEIVE> send(T rpcType, SEND protobufBody, Class<RECEIVE> clazz, io.netty.buffer.ByteBuf... dataBodies)
public <SEND extends com.google.protobuf.MessageLite,RECEIVE extends com.google.protobuf.MessageLite> void send(RpcOutcomeListener<RECEIVE> listener, SEND protobufBody, boolean allowInEventLoop, io.netty.buffer.ByteBuf... dataBodies)
protected void connectAsClient(RpcConnectionHandler<CC> connectionListener, HS handshakeValue, String host, int port)
public void setAutoRead(boolean enableAutoRead)
public void close()
Copyright © 1970 The Apache Software Foundation. All rights reserved.