public class ControllerImpl extends Object implements Controller
Controller.CustomMessageHandler<REQUEST,RESPONSE>, Controller.CustomResponse<RESPONSE>, Controller.CustomSerDe<MSG>
Constructor and Description |
---|
ControllerImpl(BootStrapContext context,
BufferAllocator allocator,
ControlMessageHandler handler) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
ControlTunnel |
getTunnel(CoordinationProtos.DrillbitEndpoint endpoint)
Get a Bit to Bit communication tunnel.
|
<REQUEST,RESPONSE> |
registerCustomHandler(int messageTypeId,
Controller.CustomMessageHandler<REQUEST,RESPONSE> handler,
Controller.CustomSerDe<REQUEST> requestSerde,
Controller.CustomSerDe<RESPONSE> responseSerde)
Register a new handler for custom message types.
|
<REQUEST extends com.google.protobuf.MessageLite,RESPONSE extends com.google.protobuf.MessageLite> |
registerCustomHandler(int messageTypeId,
Controller.CustomMessageHandler<REQUEST,RESPONSE> handler,
com.google.protobuf.Parser<REQUEST> parser)
Register a new handler for custom message types.
|
CoordinationProtos.DrillbitEndpoint |
start(CoordinationProtos.DrillbitEndpoint partialEndpoint,
boolean allowPortHunting) |
public ControllerImpl(BootStrapContext context, BufferAllocator allocator, ControlMessageHandler handler) throws DrillbitStartupException
DrillbitStartupException
public CoordinationProtos.DrillbitEndpoint start(CoordinationProtos.DrillbitEndpoint partialEndpoint, boolean allowPortHunting)
start
in interface Controller
public ControlTunnel getTunnel(CoordinationProtos.DrillbitEndpoint endpoint)
Controller
getTunnel
in interface Controller
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)
Controller
registerCustomHandler
in interface Controller
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.public <REQUEST,RESPONSE> void registerCustomHandler(int messageTypeId, Controller.CustomMessageHandler<REQUEST,RESPONSE> handler, Controller.CustomSerDe<REQUEST> requestSerde, Controller.CustomSerDe<RESPONSE> responseSerde)
Controller
registerCustomHandler
in interface Controller
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.public void close() throws Exception
close
in interface AutoCloseable
Exception
Copyright © 1970 The Apache Software Foundation. All rights reserved.