public class BeaconSendingContext extends java.lang.Object implements AdditionalQueryParameters
All package-private methods in this class shall only be accessed from the beacon sending thread, since they are not thread safe. All public methods are thread safe, unless explicitly stated.
| Constructor and Description |
|---|
BeaconSendingContext(Logger logger,
HTTPClientConfiguration httpClientConfiguration,
HTTPClientProvider httpClientProvider,
TimingProvider timingProvider)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addSession(SessionImpl session)
Adds the given session to the internal container of sessions.
|
void |
executeCurrentState()
Executes the current state.
|
long |
getConfigurationTimestamp()
Returns the current timestamp of the configuration received by the server
|
int |
getCurrentServerId()
Returns the current server ID to be used for creating new sessions
|
ServerConfiguration |
getLastServerConfiguration()
Returns the last known
ServerConfiguration. |
boolean |
isInitialized()
Get a boolean indicating whether OpenKit is initialized or not.
|
boolean |
isInTerminalState()
Gets a boolean indicating whether the current state is a terminal state or not.
|
boolean |
isShutdownRequested()
Gets a boolean flag indicating whether shutdown was requested before or not.
|
void |
requestShutdown()
Requests a shutdown.
|
boolean |
waitForInit()
Wait until OpenKit has been fully initialized.
|
boolean |
waitForInit(long timeoutMillis)
Wait until OpenKit has been fully initialized or timeout expired.
|
public BeaconSendingContext(Logger logger, HTTPClientConfiguration httpClientConfiguration, HTTPClientProvider httpClientProvider, TimingProvider timingProvider)
The state is initialized to BeaconSendingInitState,
public void executeCurrentState()
This method must only be called from the beacon sending thread, since it's not thread safe.
public void requestShutdown()
public boolean isShutdownRequested()
public boolean waitForInit()
If initialization is interrupted (e.g. requestShutdown() was called), then this method also returns.
true OpenKit is fully initialized, false OpenKit init got interrupted.public boolean waitForInit(long timeoutMillis)
If initialization is interrupted (e.g. requestShutdown() was called), then this method also returns.
timeoutMillis - The maximum number of milliseconds to wait for initialization being completed.true if OpenKit is fully initialized, false if OpenKit init got interrupted or time to wait expired.public boolean isInitialized()
true if OpenKit is initialized, false otherwise.public boolean isInTerminalState()
This method must only be called from the beacon sending thread, since it's not thread safe.
true if the current state is a terminal state, false otherwise.public ServerConfiguration getLastServerConfiguration()
ServerConfiguration.public int getCurrentServerId()
public void addSession(SessionImpl session)
session - The new session to add.public long getConfigurationTimestamp()
AdditionalQueryParametersgetConfigurationTimestamp in interface AdditionalQueryParameters