public interface Endpoint extends Stateful<EndpointState>
Note that while this interface has been around since the 1.x days, it has been changed up quite a bit to make it simpler and provide more functionality based on real world experience with the first iteration.
Modifier and Type | Method and Description |
---|---|
void |
connect()
Instruct this
Endpoint to connect. |
EndpointContext |
context()
Returns the context for this endpoint.
|
EndpointDiagnostics |
diagnostics()
Returns diagnostics information for this endpoint.
|
void |
disconnect()
Instruct this
Endpoint to disconnect. |
boolean |
freeToWrite()
If new requests can be written to this endpoint
|
InternalEndpointDiagnostics |
internalDiagnostics() |
Throwable |
lastConnectAttemptFailure()
Returns the failure reason of the last connect attempt, if any.
|
long |
lastConnectedAt()
Returns the timestamp when the endpoint was last connected successfully (nanoseconds).
|
long |
lastResponseReceived()
Holds the timestamp of the last response received (or 0 if no request ever sent).
|
long |
outstandingRequests()
If this endpoint has one or more outstanding requests.
|
boolean |
receivedDisconnectSignal()
On this endpoint
disconnect() has been called on. |
String |
remoteHostname()
Returns the remote hostname this endpoint is connected to (without the port).
|
int |
remotePort()
Returns the remotePort this endpoint is connected to.
|
<R extends Request<? extends Response>> |
send(R request)
Sends the request into this
Endpoint . |
void connect()
Endpoint
to connect.
This method is async and will return immediately. Use the other methods available to inspect the current state of the endpoint, signaling potential successful connection attempts.
void disconnect()
Endpoint
to disconnect.
This method is async and will return immediately. Use the other methods available to inspect the current state of the endpoint, signaling potential successful disconnection attempts.
<R extends Request<? extends Response>> void send(R request)
Endpoint
.
Note that there is no guarantee that the request will actually dispatched, based on the state this endpoint is in.
request
- the request to send.boolean freeToWrite()
long outstandingRequests()
long lastResponseReceived()
long lastConnectedAt()
EndpointDiagnostics diagnostics()
@Stability.Internal InternalEndpointDiagnostics internalDiagnostics()
boolean receivedDisconnectSignal()
disconnect()
has been called on.
This is different from an endpoint just being disconnected on the remote side and continuing reconnect attempts. Once this returns true, it is never coming back.
disconnect()
has been called.EndpointContext context()
String remoteHostname()
int remotePort()
Throwable lastConnectAttemptFailure()
Copyright © 2024 Couchbase, Inc.. All rights reserved.