public class TransportService extends AbstractLifecycleComponent<TransportService>
Modifier and Type | Class and Description |
---|---|
protected class |
TransportService.Adapter |
Modifier and Type | Field and Description |
---|---|
protected ClusterName |
clusterName |
static java.lang.String |
DIRECT_RESPONSE_PROFILE |
protected TaskManager |
taskManager |
protected ThreadPool |
threadPool |
static Setting<java.util.List<java.lang.String>> |
TRACE_LOG_EXCLUDE_SETTING |
static Setting<java.util.List<java.lang.String>> |
TRACE_LOG_INCLUDE_SETTING |
protected Transport |
transport |
lifecycle
deprecationLogger, logger, settings
Constructor and Description |
---|
TransportService(Settings settings,
Transport transport,
ThreadPool threadPool) |
Modifier and Type | Method and Description |
---|---|
void |
acceptIncomingRequests()
start accepting incoming requests.
|
void |
addConnectionListener(TransportConnectionListener listener) |
TransportAddress[] |
addressesFromString(java.lang.String address,
int perAddressLimit) |
boolean |
addressSupported(java.lang.Class<? extends TransportAddress> address) |
BoundTransportAddress |
boundAddress() |
void |
connectToNode(DiscoveryNode node) |
void |
connectToNodeLight(DiscoveryNode node)
Lightly connect to the specified node
|
DiscoveryNode |
connectToNodeLightAndHandshake(DiscoveryNode node,
long handshakeTimeout)
Lightly connect to the specified node, and handshake cluster
name and version
|
DiscoveryNode |
connectToNodeLightAndHandshake(DiscoveryNode node,
long handshakeTimeout,
boolean checkClusterName)
Lightly connect to the specified node, returning updated node
information.
|
protected TransportService.Adapter |
createAdapter() |
protected TaskManager |
createTaskManager() |
void |
disconnectFromNode(DiscoveryNode node) |
protected void |
doClose() |
protected void |
doStart() |
protected void |
doStop() |
java.util.List<java.lang.String> |
getLocalAddresses() |
protected RequestHandlerRegistry |
getRequestHandler(java.lang.String action) |
TaskManager |
getTaskManager() |
TransportInfo |
info() |
boolean |
nodeConnected(DiscoveryNode node) |
protected <Request extends TransportRequest> |
registerRequestHandler(RequestHandlerRegistry<Request> reg) |
<Request extends TransportRequest> |
registerRequestHandler(java.lang.String action,
java.util.function.Supplier<Request> request,
java.lang.String executor,
boolean forceExecution,
boolean canTripCircuitBreaker,
TransportRequestHandler<Request> handler)
Registers a new request handler
|
<Request extends TransportRequest> |
registerRequestHandler(java.lang.String action,
java.util.function.Supplier<Request> requestFactory,
java.lang.String executor,
TransportRequestHandler<Request> handler)
Registers a new request handler
|
void |
removeConnectionListener(TransportConnectionListener listener) |
void |
removeHandler(java.lang.String action) |
<T extends TransportResponse> |
sendRequest(DiscoveryNode node,
java.lang.String action,
TransportRequest request,
TransportRequestOptions options,
TransportResponseHandler<T> handler) |
<T extends TransportResponse> |
sendRequest(DiscoveryNode node,
java.lang.String action,
TransportRequest request,
TransportResponseHandler<T> handler) |
void |
setDynamicSettings(ClusterSettings clusterSettings) |
void |
setLocalNode(DiscoveryNode localNode)
makes the transport service aware of the local node.
|
TransportStats |
stats() |
<T extends TransportResponse> |
submitRequest(DiscoveryNode node,
java.lang.String action,
TransportRequest request,
TransportRequestOptions options,
TransportResponseHandler<T> handler) |
<T extends TransportResponse> |
submitRequest(DiscoveryNode node,
java.lang.String action,
TransportRequest request,
TransportResponseHandler<T> handler) |
addLifecycleListener, close, lifecycleState, removeLifecycleListener, start, stop
logDeprecatedSetting, logRemovedSetting, nodeName
public static final java.lang.String DIRECT_RESPONSE_PROFILE
protected final Transport transport
protected final ThreadPool threadPool
protected final ClusterName clusterName
protected final TaskManager taskManager
public static final Setting<java.util.List<java.lang.String>> TRACE_LOG_INCLUDE_SETTING
public static final Setting<java.util.List<java.lang.String>> TRACE_LOG_EXCLUDE_SETTING
@Inject public TransportService(Settings settings, Transport transport, ThreadPool threadPool)
public void setLocalNode(DiscoveryNode localNode)
public TaskManager getTaskManager()
protected TransportService.Adapter createAdapter()
protected TaskManager createTaskManager()
@Inject(optional=true) public void setDynamicSettings(ClusterSettings clusterSettings)
protected void doStart()
doStart
in class AbstractLifecycleComponent<TransportService>
protected void doStop()
doStop
in class AbstractLifecycleComponent<TransportService>
protected void doClose()
doClose
in class AbstractLifecycleComponent<TransportService>
public void acceptIncomingRequests()
public boolean addressSupported(java.lang.Class<? extends TransportAddress> address)
public TransportInfo info()
public TransportStats stats()
public BoundTransportAddress boundAddress()
public java.util.List<java.lang.String> getLocalAddresses()
public boolean nodeConnected(DiscoveryNode node)
public void connectToNode(DiscoveryNode node) throws ConnectTransportException
ConnectTransportException
public void connectToNodeLight(DiscoveryNode node)
node
- the node to connect topublic DiscoveryNode connectToNodeLightAndHandshake(DiscoveryNode node, long handshakeTimeout) throws ConnectTransportException
node
- the node to connect tohandshakeTimeout
- handshake timeoutConnectTransportException
- if the connection or the
handshake failedpublic DiscoveryNode connectToNodeLightAndHandshake(DiscoveryNode node, long handshakeTimeout, boolean checkClusterName)
checkClusterName
is true
.node
- the node to connect tohandshakeTimeout
- handshake timeoutcheckClusterName
- whether or not to ignore cluster name
mismatchesConnectTransportException
- if the connection failedjava.lang.IllegalStateException
- if the handshake failedpublic void disconnectFromNode(DiscoveryNode node)
public void addConnectionListener(TransportConnectionListener listener)
public void removeConnectionListener(TransportConnectionListener listener)
public <T extends TransportResponse> TransportFuture<T> submitRequest(DiscoveryNode node, java.lang.String action, TransportRequest request, TransportResponseHandler<T> handler) throws TransportException
TransportException
public <T extends TransportResponse> TransportFuture<T> submitRequest(DiscoveryNode node, java.lang.String action, TransportRequest request, TransportRequestOptions options, TransportResponseHandler<T> handler) throws TransportException
TransportException
public <T extends TransportResponse> void sendRequest(DiscoveryNode node, java.lang.String action, TransportRequest request, TransportResponseHandler<T> handler)
public <T extends TransportResponse> void sendRequest(DiscoveryNode node, java.lang.String action, TransportRequest request, TransportRequestOptions options, TransportResponseHandler<T> handler)
public TransportAddress[] addressesFromString(java.lang.String address, int perAddressLimit) throws java.lang.Exception
java.lang.Exception
public <Request extends TransportRequest> void registerRequestHandler(java.lang.String action, java.util.function.Supplier<Request> requestFactory, java.lang.String executor, TransportRequestHandler<Request> handler)
action
- The action the request handler is associated withrequestFactory
- a callable to be used construct new instances for streamingexecutor
- The executor the request handling will be executed onhandler
- The handler itself that implements the request handlingpublic <Request extends TransportRequest> void registerRequestHandler(java.lang.String action, java.util.function.Supplier<Request> request, java.lang.String executor, boolean forceExecution, boolean canTripCircuitBreaker, TransportRequestHandler<Request> handler)
action
- The action the request handler is associated withrequest
- The request class that will be used to constrcut new instances for streamingexecutor
- The executor the request handling will be executed onforceExecution
- Force execution on the executor queue and never reject itcanTripCircuitBreaker
- Check the request size and raise an exception in case the limit is breached.handler
- The handler itself that implements the request handlingprotected <Request extends TransportRequest> void registerRequestHandler(RequestHandlerRegistry<Request> reg)
public void removeHandler(java.lang.String action)
protected RequestHandlerRegistry getRequestHandler(java.lang.String action)