Interface Endpoint
-
- All Known Implementing Classes:
AnalyticsEndpoint
,BaseEndpoint
,KeyValueEndpoint
,ManagerEndpoint
,QueryEndpoint
,SearchEndpoint
,ViewEndpoint
public interface Endpoint
The parent interface for all endpoints.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.
- Since:
- 1.0.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
connect()
Instruct thisEndpoint
to connect.void
disconnect()
Instruct thisEndpoint
to disconnect.boolean
free()
If this endpoint has currently one or more requests outstanding.long
lastResponseReceived()
Holds the timestamp of the last response received (or 0 if no request ever sent).<R extends Request<? extends Response>>
voidsend(R request)
Sends the request into thisEndpoint
.EndpointState
state()
Returns the current state of thisEndpoint
.
-
-
-
Method Detail
-
connect
void connect()
Instruct thisEndpoint
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.
-
disconnect
void disconnect()
Instruct thisEndpoint
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.
-
send
<R extends Request<? extends Response>> void send(R request)
Sends the request into thisEndpoint
.Note that there is no guarantee that the request will actually dispatched, based on the state this endpoint is in.
- Parameters:
request
- the request to send.
-
state
EndpointState state()
Returns the current state of thisEndpoint
.- Returns:
- the state of this endpoint.
-
free
boolean free()
If this endpoint has currently one or more requests outstanding.- Returns:
- true if free, false otherwise.
-
lastResponseReceived
long lastResponseReceived()
Holds the timestamp of the last response received (or 0 if no request ever sent).- Returns:
- the timestamp of the last response received.
-
-