Package com.launchdarkly.eventsource
Class ConnectStrategy.Client
java.lang.Object
com.launchdarkly.eventsource.ConnectStrategy.Client
- All Implemented Interfaces:
Closeable,AutoCloseable
- Enclosing class:
- ConnectStrategy
An object provided by
ConnectStrategy that is retained by a
single EventSource instance to perform all connection attempts
by that instance.
For the default HTTP implementation, this represents a configured HTTP client.
The Closeable.close() method should be implemented to do any necessary
cleanup when an EventSource instance is being permanently disposed of.
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract booleanawaitClosed(long timeoutMillis) abstract ConnectStrategy.Client.ResultAttempts to connect to a stream.abstract URIReturns the expected URI of the stream.
-
Constructor Details
-
Client
public Client()
-
-
Method Details
-
connect
Attempts to connect to a stream.- Parameters:
lastEventId- the current value ofEventSource.getLastEventId()(should be sent to the server to support resuming an interrupted stream)- Returns:
- the result if successful
- Throws:
StreamException- if not successful
-
awaitClosed
- Parameters:
timeoutMillis- maximum amount of time to wait- Returns:
- true if all requests are now closed
- Throws:
InterruptedException- if the thread is interrupted
-
getOrigin
Returns the expected URI of the stream.This value is returned by
EventSource.getOrigin(). It can be overridden on a per-connection basis withConnectStrategy.Client.Result.getOrigin().- Returns:
- the stream URI
-