Package org.elasticsearch.transport
Interface Transport
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,LifecycleComponent
,Releasable
- All Known Implementing Classes:
TcpTransport
public interface Transport extends LifecycleComponent
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Transport.Connection
A unidirectional connection to aDiscoveryNode
static class
Transport.ResponseContext<T extends TransportResponse>
This class represents a response context that encapsulates the actual response handler, the action and the conneciton it was executed on.static class
Transport.ResponseHandlers
This class is a registry that allows
-
Field Summary
Fields Modifier and Type Field Description static Setting<java.lang.Boolean>
TRANSPORT_TCP_COMPRESS
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
addConnectionListener(TransportConnectionListener listener)
Adds a new event listenerTransportAddress[]
addressesFromString(java.lang.String address, int perAddressLimit)
Returns an address from its string representation.BoundTransportAddress
boundAddress()
The address the transport is bound on.void
connectToNode(DiscoveryNode node, ConnectionProfile connectionProfile, CheckedBiConsumer<Transport.Connection,ConnectionProfile,java.io.IOException> connectionValidator)
Connects to a node with the given connection profile.void
disconnectFromNode(DiscoveryNode node)
Disconnected from the given node, if not connected, will do nothing.Transport.Connection
getConnection(DiscoveryNode node)
Returns a connection for the given node if the node is connected.default CircuitBreaker
getInFlightRequestBreaker()
java.util.List<java.lang.String>
getLocalAddresses()
Returns a list of all local adresses for this transportRequestHandlerRegistry
getRequestHandler(java.lang.String action)
Returns the registered request handler registry for the given action ornull
if it's not registeredTransport.ResponseHandlers
getResponseHandlers()
TransportStats
getStats()
boolean
nodeConnected(DiscoveryNode node)
Returnstrue
if the node is connected.Transport.Connection
openConnection(DiscoveryNode node, ConnectionProfile profile)
Opens a new connection to the given node and returns it.java.util.Map<java.lang.String,BoundTransportAddress>
profileBoundAddresses()
Further profile bound addresses<Request extends TransportRequest>
voidregisterRequestHandler(RequestHandlerRegistry<Request> reg)
Registers a new request handlerboolean
removeConnectionListener(TransportConnectionListener listener)
Removes an event listener-
Methods inherited from interface org.elasticsearch.common.component.LifecycleComponent
addLifecycleListener, lifecycleState, removeLifecycleListener, start, stop
-
Methods inherited from interface org.elasticsearch.common.lease.Releasable
close
-
-
-
-
Field Detail
-
TRANSPORT_TCP_COMPRESS
static final Setting<java.lang.Boolean> TRANSPORT_TCP_COMPRESS
-
-
Method Detail
-
registerRequestHandler
<Request extends TransportRequest> void registerRequestHandler(RequestHandlerRegistry<Request> reg)
Registers a new request handler
-
getRequestHandler
RequestHandlerRegistry getRequestHandler(java.lang.String action)
Returns the registered request handler registry for the given action ornull
if it's not registered- Parameters:
action
- the action to look up
-
addConnectionListener
void addConnectionListener(TransportConnectionListener listener)
Adds a new event listener- Parameters:
listener
- the listener to add
-
removeConnectionListener
boolean removeConnectionListener(TransportConnectionListener listener)
Removes an event listener- Parameters:
listener
- the listener to remove- Returns:
true
iff the listener was removed otherwisefalse
-
boundAddress
BoundTransportAddress boundAddress()
The address the transport is bound on.
-
profileBoundAddresses
java.util.Map<java.lang.String,BoundTransportAddress> profileBoundAddresses()
Further profile bound addresses- Returns:
null
iff profiles are unsupported, otherwise a map with name of profile and its bound transport address
-
addressesFromString
TransportAddress[] addressesFromString(java.lang.String address, int perAddressLimit) throws java.net.UnknownHostException
Returns an address from its string representation.- Throws:
java.net.UnknownHostException
-
nodeConnected
boolean nodeConnected(DiscoveryNode node)
Returnstrue
if the node is connected.
-
connectToNode
void connectToNode(DiscoveryNode node, ConnectionProfile connectionProfile, CheckedBiConsumer<Transport.Connection,ConnectionProfile,java.io.IOException> connectionValidator) throws ConnectTransportException
Connects to a node with the given connection profile. If the node is already connected this method has no effect. Once a successful is established, it can be validated before being exposed.- Throws:
ConnectTransportException
-
disconnectFromNode
void disconnectFromNode(DiscoveryNode node)
Disconnected from the given node, if not connected, will do nothing.
-
getLocalAddresses
java.util.List<java.lang.String> getLocalAddresses()
Returns a list of all local adresses for this transport
-
getInFlightRequestBreaker
default CircuitBreaker getInFlightRequestBreaker()
-
getConnection
Transport.Connection getConnection(DiscoveryNode node)
Returns a connection for the given node if the node is connected. Connections returned from this method must not be closed. The lifecycle of this connection is maintained by the Transport implementation.- Throws:
NodeNotConnectedException
- if the node is not connected- See Also:
connectToNode(DiscoveryNode, ConnectionProfile, CheckedBiConsumer)
-
openConnection
Transport.Connection openConnection(DiscoveryNode node, ConnectionProfile profile) throws java.io.IOException
Opens a new connection to the given node and returns it. In contrast toconnectToNode(DiscoveryNode, ConnectionProfile, CheckedBiConsumer)
the returned connection is not managed by the transport implementation. This connection must be closed once it's not needed anymore. This connection type can be used to execute a handshake between two nodes before the node will be published viaconnectToNode(DiscoveryNode, ConnectionProfile, CheckedBiConsumer)
.- Throws:
java.io.IOException
-
getStats
TransportStats getStats()
-
getResponseHandlers
Transport.ResponseHandlers getResponseHandlers()
-
-