Class BeaconSendingContext

  • All Implemented Interfaces:
    AdditionalQueryParameters

    public class BeaconSendingContext
    extends java.lang.Object
    implements AdditionalQueryParameters
    State context for beacon sending states.

    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.

    • Method Detail

      • executeCurrentState

        public void executeCurrentState()
        Executes the current state.

        This method must only be called from the beacon sending thread, since it's not thread safe.

      • requestShutdown

        public void requestShutdown()
        Requests a shutdown.
      • isShutdownRequested

        public boolean isShutdownRequested()
        Gets a boolean flag indicating whether shutdown was requested before or not.
      • waitForInit

        public boolean waitForInit()
        Wait until OpenKit has been fully initialized.

        If initialization is interrupted (e.g. requestShutdown() was called), then this method also returns.

        Returns:
        true OpenKit is fully initialized, false OpenKit init got interrupted.
      • waitForInit

        public boolean waitForInit​(long timeoutMillis)
        Wait until OpenKit has been fully initialized or timeout expired.

        If initialization is interrupted (e.g. requestShutdown() was called), then this method also returns.

        Parameters:
        timeoutMillis - The maximum number of milliseconds to wait for initialization being completed.
        Returns:
        true if OpenKit is fully initialized, false if OpenKit init got interrupted or time to wait expired.
      • isInitialized

        public boolean isInitialized()
        Get a boolean indicating whether OpenKit is initialized or not.
        Returns:
        true if OpenKit is initialized, false otherwise.
      • isInTerminalState

        public boolean isInTerminalState()
        Gets a boolean indicating whether the current state is a terminal state or not.

        This method must only be called from the beacon sending thread, since it's not thread safe.

        Returns:
        true if the current state is a terminal state, false otherwise.
      • getCurrentServerId

        public int getCurrentServerId()
        Returns the current server ID to be used for creating new sessions
      • addSession

        public void addSession​(SessionImpl session)
        Adds the given session to the internal container of sessions.
        Parameters:
        session - The new session to add.