public class BeaconSender
extends java.lang.Object
The BeaconSender manages the thread running OpenKit communication in the background.
| Constructor and Description |
|---|
BeaconSender(Logger logger,
Configuration configuration,
HTTPClientProvider clientProvider,
TimingProvider timingProvider)
Create a new BeaconSender.
|
| Modifier and Type | Method and Description |
|---|---|
void |
finishSession(SessionImpl session)
When finishing a Session, remove it from open Sessions and put it into finished Sessions.
|
void |
initialize()
Start beacon sender thread.
|
boolean |
isInitialized()
Get a boolean indicating whether OpenKit has been initialized or not.
|
void |
shutdown()
Shutdown the BeaconSender and wait until it's shutdown (at most
SHUTDOWN_TIMEOUT milliseconds. |
void |
startSession(SessionImpl session)
When starting a new Session, put it into open Sessions.
|
boolean |
waitForInit()
Wait until OpenKit is fully initialized or a shutdown request has been made.
|
boolean |
waitForInit(long timeoutMillis)
Wait until OpenKit is fully initialized or a shutdown request has been made or given timeout expired.
|
public BeaconSender(Logger logger, Configuration configuration, HTTPClientProvider clientProvider, TimingProvider timingProvider)
To start the beacon sending the initialize() method must be called.
logger - configuration - OpenKit configuration.clientProvider - Used for retrieving an HTTPClient instance.timingProvider - Used for some timing related things.public void initialize()
Note: The beacon sender has to perform some initialization code, which is done in the background,
before it actually starts sending beacons.
If it's a must to have OpenKit fully initialized use the waitForInit() method to wait until initialized.
public boolean waitForInit()
This method might hang forever.
true if OpenKit is fully initialized, or false if shutdown has been requested during init phase.public boolean waitForInit(long timeoutMillis)
timeoutMillis - The maximum number of milliseconds to wait for initialization being completed.true if OpenKit is fully initialized, or false if shutdown has been requested during init phase.public boolean isInitialized()
true if OpenKit has been initialized, false otherwise.public void shutdown()
SHUTDOWN_TIMEOUT milliseconds.public void startSession(SessionImpl session)
A session is only put into the open Sessions if capturing is enabled. In case capturing is disabled, this method has no effect.
session - Session to start.public void finishSession(SessionImpl session)
As soon as a session get's finished it will be transferred to the server.
session - Session to finish.