java.lang.AutoCloseable
, java.io.Closeable
, LifecycleComponent
, Releasable
TcpTransport
public interface Transport extends LifecycleComponent
Modifier and Type | Interface | Description |
---|---|---|
static interface |
Transport.Connection |
A unidirectional connection to a
DiscoveryNode |
Modifier and Type | Field | Description |
---|---|---|
static Setting<java.lang.Boolean> |
TRANSPORT_TCP_COMPRESS |
Modifier and Type | Method | Description |
---|---|---|
TransportAddress[] |
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() |
|
TransportStats |
getStats() |
|
long |
newRequestId() |
Returns a new request ID to use when sending a message via
Transport.Connection.sendRequest(long, String,
TransportRequest, TransportRequestOptions) |
boolean |
nodeConnected(DiscoveryNode node) |
Returns true 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
|
void |
setTransportService(TransportService service) |
addLifecycleListener, lifecycleState, removeLifecycleListener, start, stop
close
static final Setting<java.lang.Boolean> TRANSPORT_TCP_COMPRESS
void setTransportService(TransportService service)
BoundTransportAddress boundAddress()
java.util.Map<java.lang.String,BoundTransportAddress> profileBoundAddresses()
null
iff profiles are unsupported, otherwise a map with name of profile and its bound transport addressTransportAddress[] addressesFromString(java.lang.String address, int perAddressLimit) throws java.net.UnknownHostException
java.net.UnknownHostException
boolean nodeConnected(DiscoveryNode node)
void connectToNode(DiscoveryNode node, ConnectionProfile connectionProfile, CheckedBiConsumer<Transport.Connection,ConnectionProfile,java.io.IOException> connectionValidator) throws ConnectTransportException
ConnectTransportException
void disconnectFromNode(DiscoveryNode node)
java.util.List<java.lang.String> getLocalAddresses()
default CircuitBreaker getInFlightRequestBreaker()
long newRequestId()
Transport.Connection.sendRequest(long, String,
TransportRequest, TransportRequestOptions)
Transport.Connection getConnection(DiscoveryNode node)
NodeNotConnectedException
- if the node is not connectedconnectToNode(DiscoveryNode, ConnectionProfile, CheckedBiConsumer)
Transport.Connection openConnection(DiscoveryNode node, ConnectionProfile profile) throws java.io.IOException
connectToNode(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 via
connectToNode(DiscoveryNode, ConnectionProfile, CheckedBiConsumer)
.java.io.IOException
TransportStats getStats()