Package org.apache.drill.exec.rpc.user
Class UserServer.BitToUserConnection
java.lang.Object
org.apache.drill.exec.rpc.AbstractRemoteConnection
org.apache.drill.exec.rpc.AbstractServerConnection<UserServer.BitToUserConnection>
org.apache.drill.exec.rpc.user.UserServer.BitToUserConnection
- All Implemented Interfaces:
AutoCloseable,ConnectionThrottle,EncryptionContext,RemoteConnection,ServerConnection<UserServer.BitToUserConnection>,UserClientConnection
- Enclosing class:
UserServer
public class UserServer.BitToUserConnection
extends AbstractServerConnection<UserServer.BitToUserConnection>
implements UserClientConnection
Represents a client connection accepted by Foreman Drillbit's UserServer
from a DrillClient. This connection is used to get hold of
UserSession which stores all session related information like
session options changed over the lifetime of this connection. There is a
1:1 mapping between a BitToUserConnection and a UserSession. This
connection object is also used to send query data and result back to the
client submitted as part of the session tied to this connection.-
Field Summary
Fields inherited from class org.apache.drill.exec.rpc.AbstractRemoteConnection
saslCodec -
Method Summary
Modifier and TypeMethodDescriptionvoidCalled from the RpcBus's channel close handler to close all remaining resources associated with this connection.voidclose()Connection consumer wants to close connection.voidvoidio.netty.util.concurrent.Future<Void> Returns theFuturewhich will be notified when this channel is closed.protected org.slf4j.LoggervoidvoidsendData(RpcOutcomeListener<GeneralRPCProtos.Ack> listener, QueryDataPackage data) Send query data to client.voidsendResult(RpcOutcomeListener<GeneralRPCProtos.Ack> listener, UserBitShared.QueryResult result) Send query result outcome to client.Methods inherited from class org.apache.drill.exec.rpc.AbstractServerConnection
changeHandlerTo, disposeSaslServer, getAllocator, getCurrentHandler, getSaslServer, initSaslServer, setEncryption, setMaxWrappedSizeMethods inherited from class org.apache.drill.exec.rpc.AbstractRemoteConnection
addSecurityHandlers, blockOnNotWritable, createNewRpcListener, getAndRemoveRpcOutcome, getChannel, getEncryptionCtxtString, getMaxWrappedSize, getName, getWrapSizeLimit, inEventLoop, isActive, isEncryptionEnabled, recordRemoteFailure, setAutoRead, setWrapSizeLimitMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.drill.exec.rpc.ConnectionThrottle
setAutoReadMethods inherited from interface org.apache.drill.exec.rpc.EncryptionContext
getEncryptionCtxtString, getMaxWrappedSize, getWrapSizeLimit, isEncryptionEnabled, setWrapSizeLimitMethods inherited from interface org.apache.drill.exec.rpc.RemoteConnection
addSecurityHandlers, blockOnNotWritable, createNewRpcListener, getAndRemoveRpcOutcome, getChannel, getName, inEventLoop, isActive, recordRemoteFailure
-
Method Details
-
finalizeSaslSession
- Specified by:
finalizeSaslSessionin interfaceServerConnection<UserServer.BitToUserConnection>- Overrides:
finalizeSaslSessionin classAbstractServerConnection<UserServer.BitToUserConnection>- Throws:
IOException
-
getSession
- Specified by:
getSessionin interfaceUserClientConnection- Returns:
- User session object.
-
getLogger
protected org.slf4j.Logger getLogger()- Specified by:
getLoggerin classAbstractServerConnection<UserServer.BitToUserConnection>
-
sendData
Description copied from interface:UserClientConnectionSend query data to client. Outcome is returned throughlistener.- Specified by:
sendDatain interfaceUserClientConnection- Parameters:
listener- The listenerdata- The data to be sent
-
getClosureFuture
Description copied from interface:UserClientConnectionReturns theFuturewhich will be notified when this channel is closed. This method always returns the same future instance.- Specified by:
getClosureFuturein interfaceUserClientConnection
-
getRemoteAddress
- Specified by:
getRemoteAddressin interfaceRemoteConnection- Specified by:
getRemoteAddressin interfaceUserClientConnection- Overrides:
getRemoteAddressin classAbstractRemoteConnection- Returns:
- Return the client node address.
-
channelClosed
Description copied from class:AbstractRemoteConnectionCalled from the RpcBus's channel close handler to close all remaining resources associated with this connection. Ensures that any pending back-pressure items are also unblocked so they can be thrown away.- Specified by:
channelClosedin interfaceRemoteConnection- Overrides:
channelClosedin classAbstractServerConnection<UserServer.BitToUserConnection>- Parameters:
ex- The exception that caused the channel to close.
-
close
public void close()Description copied from class:AbstractRemoteConnectionConnection consumer wants to close connection. Initiate connection close and complete. This is a blocking call that ensures that the connection is closed before returning. As part of this call, the channel close handler will be triggered which will call channelClosed() above. The latter will happen in a separate thread while this method is blocking.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.
- For connection oriented transport protocol channel moves to ACTIVE state when a connection is established using this channel. We need to have channel in ACTIVE state NOT OPEN before we can send any message to remote endpoint.
- For connectionless transport protocol a sender can send data as soon as channel moves to OPEN state.
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceRemoteConnection- Overrides:
closein classAbstractRemoteConnection
-
incConnectionCounter
public void incConnectionCounter()- Specified by:
incConnectionCounterin classAbstractRemoteConnection
-
decConnectionCounter
public void decConnectionCounter()- Specified by:
decConnectionCounterin classAbstractRemoteConnection
-