Interface Guardian.GuardContext

All Known Implementing Classes:
GuardSupport.Context
Enclosing interface:
Guardian

public static interface Guardian.GuardContext
A GuardContext represents the lifecycle status of a Guardable. The GuardContext is the point of coordination between the Guardian and the Guardable.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
    State value indicating the Guardable is healthy/responsive.
    static final int
    State value indicating that recovery of the Guardable is underway.
    static final int
    State value indicating that the Guardable is being terminated.
  • Method Summary

    Modifier and Type
    Method
    Description
    Return the Guardable for this context.
    Return the Guardian for this context.
    long
    Return the soft timeout interval for the represented Guardable.
    int
    Return the state of the Guardable.
    long
    Return the hard timeout interval for the represented Guardable.
    void
    Called by the Guardable to signal that it is still alive.
    void
    heartbeat(long cMillis)
    Called by the Guardable to signal that it is still alive, and that it should not be considered timed out for the specified number of milliseconds.
    void
    Release this context, causing the Guardian to discontinue monitoring of the represented Guardable.
  • Field Details

    • STATE_HEALTHY

      static final int STATE_HEALTHY
      State value indicating the Guardable is healthy/responsive.
      See Also:
    • STATE_RECOVERY

      static final int STATE_RECOVERY
      State value indicating that recovery of the Guardable is underway.
      See Also:
    • STATE_TERMINATING

      static final int STATE_TERMINATING
      State value indicating that the Guardable is being terminated.
      See Also:
  • Method Details

    • getGuardian

      Guardian getGuardian()
      Return the Guardian for this context.
      Returns:
      the Guardian for this context
    • getGuardable

      Guardable getGuardable()
      Return the Guardable for this context.
      Returns:
      the Guardable for this context
    • heartbeat

      void heartbeat()
      Called by the Guardable to signal that it is still alive.
    • heartbeat

      void heartbeat(long cMillis)
      Called by the Guardable to signal that it is still alive, and that it should not be considered timed out for the specified number of milliseconds.
      Parameters:
      cMillis - the number of milliseconds for which the guardable should not be considered timed out
    • getState

      int getState()
      Return the state of the Guardable. Valid values are STATE_* constants.
      Returns:
      the state of the Guardable
    • release

      void release()
      Release this context, causing the Guardian to discontinue monitoring of the represented Guardable.
    • getSoftTimeoutMillis

      long getSoftTimeoutMillis()
      Return the soft timeout interval for the represented Guardable.

      The soft timeout interval is the amount of time that must pass after the last received heartbeat before a recovery attempt is made.

      Returns:
      the soft timeout interval for the represented Guardable
    • getTimeoutMillis

      long getTimeoutMillis()
      Return the hard timeout interval for the represented Guardable.
      Returns:
      the hard timeout interval for the represented Guardable