Class ControllerImpl
java.lang.Object
org.apache.drill.exec.rpc.control.ControllerImpl
- All Implemented Interfaces:
AutoCloseable
,Controller
Manages communication tunnels between nodes.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.drill.exec.rpc.control.Controller
Controller.CustomMessageHandler<REQUEST,
RESPONSE>, Controller.CustomResponse<RESPONSE>, Controller.CustomSerDe<MSG> -
Constructor Summary
ConstructorDescriptionControllerImpl
(BootStrapContext context, BufferAllocator allocator, ControlMessageHandler handler) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
getTunnel
(CoordinationProtos.DrillbitEndpoint endpoint) Get a Bit to Bit communication tunnel.<REQUEST extends com.google.protobuf.MessageLite,
RESPONSE extends com.google.protobuf.MessageLite>
voidregisterCustomHandler
(int messageTypeId, Controller.CustomMessageHandler<REQUEST, RESPONSE> handler, com.google.protobuf.Parser<REQUEST> parser) Register a new handler for custom message types.<REQUEST,
RESPONSE>
voidregisterCustomHandler
(int messageTypeId, Controller.CustomMessageHandler<REQUEST, RESPONSE> handler, Controller.CustomSerDe<REQUEST> requestSerde, Controller.CustomSerDe<RESPONSE> responseSerde) Register a new handler for custom message types.start
(CoordinationProtos.DrillbitEndpoint partialEndpoint, boolean allowPortHunting)
-
Constructor Details
-
ControllerImpl
public ControllerImpl(BootStrapContext context, BufferAllocator allocator, ControlMessageHandler handler) throws DrillbitStartupException - Throws:
DrillbitStartupException
-
-
Method Details
-
start
public CoordinationProtos.DrillbitEndpoint start(CoordinationProtos.DrillbitEndpoint partialEndpoint, boolean allowPortHunting) - Specified by:
start
in interfaceController
-
getTunnel
Description copied from interface:Controller
Get a Bit to Bit communication tunnel. If the BitCom doesn't have a tunnel attached to the node already, it will start creating one. This create the connection asynchronously.- Specified by:
getTunnel
in interfaceController
- Returns:
-
registerCustomHandler
public <REQUEST extends com.google.protobuf.MessageLite,RESPONSE extends com.google.protobuf.MessageLite> void registerCustomHandler(int messageTypeId, Controller.CustomMessageHandler<REQUEST, RESPONSE> handler, com.google.protobuf.Parser<REQUEST> parser) Description copied from interface:Controller
Register a new handler for custom message types. Should be done before any messages. This is threadsafe as this method manages locking internally.- Specified by:
registerCustomHandler
in interfaceController
- Parameters:
messageTypeId
- The type of message id to handle. This corresponds to the CustomMessage.type field. Note that only a single handler for a particular type of message can be registered within a particular Drillbit.handler
- The handler that should be used to handle this type of message.parser
- The parser used to handle the types of messages the handler above handles.
-
registerCustomHandler
public <REQUEST,RESPONSE> void registerCustomHandler(int messageTypeId, Controller.CustomMessageHandler<REQUEST, RESPONSE> handler, Controller.CustomSerDe<REQUEST> requestSerde, Controller.CustomSerDe<RESPONSE> responseSerde) Description copied from interface:Controller
Register a new handler for custom message types. Should be done before any messages. This is threadsafe as this method manages locking internally.- Specified by:
registerCustomHandler
in interfaceController
- Parameters:
messageTypeId
- The type of message id to handle. This corresponds to the CustomMessage.type field. Note that only a single handler for a particular type of message can be registered within a particular Drillbit.handler
- The handler that should be used to handle this type of message.requestSerde
- CustomSerDe for incoming requests.responseSerde
- CustomSerDe for serializing responses.
-
close
- Specified by:
close
in interfaceAutoCloseable
- Throws:
Exception
-