Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.net
Class GuardSupport

`java.lang.Object
com.tangosol.util.Base
com.tangosol.net.GuardSupport`

      public class GuardSupport

extends Base

A concrete implementation of Guardian/Guardable interactions. GuardSupport is used by a Guardian to manage its responsibilities.

Since:
  Coherence 3.5
Author:
  rhl

Nested Class Summary
`protected class` | `GuardSupport.Context` Base implementation for GuardContext's used by GuardSupport.

Field Summary
`protected static long` | `GUARDIAN_EARLY_THRESHOLD` The threshold before which than which a guardian considers itself early in checking its guardiables.
`protected static long` | `GUARDIAN_LATE_THRESHOLD` The threshold past which a guardian considers itself late in checking its guardiables.
`protected static long` | `GUARDIAN_LOG_INTERVAL` The minimum interval at which the Guardian should log thread dumps.
`static long` | `GUARDIAN_MAX_CHECK_INTERVAL` The maximum interval at which the Guardian thread should call check() to verify its guardables.
`protected GuardSupport.Context[]` | `m_aGuardContext` Array of GuardContexts for the registered Guardables.
`protected int` | `m_cGuardable` The number of registered Guardables.
`protected Guardian` | `m_guardian` The Guardian that is managing this GuardSupport.
`protected long` | `m_ldtNextCheck` The next time at which the Guardables should be checked.
`protected static java.lang.ThreadLocal` | `m_tlContext` ThreadLocal containing the GuardContext associated with the current thread.
`protected static AtomicCounter` | `s_atomicLogTime` Atomic counter containing the last log time stamp.

Constructor Summary
`GuardSupport(Guardian guardian)` Construct a GuardSupport for the specified Guardian.

Method Summary
`Guardian.GuardContext` | `add(Guardable guardable, long cMillis, float flPctRecover)` Add the specified guardable to the set of Guardables managed by this manager, subject to the specified service parameters.
`long` | `check()` Check the registered Guardable objects for timeout, taking appropriate action and calculate the timestamp when the next check should be performed.
`int` | `getGuardableCount()` Return the number of Guardables that are registered with this GuardSupport.
`protected GuardSupport.Context[]` | `getGuardContexts()` Return the array of GuardContext objects for the Guardables managed by this GuardSupport.
`protected Guardian` | `getGuardian()` Return the Guardian that manages this GuardSupport.
`long` | `getNextCheckTime()` Return the next time at which the Guardables should be checked.
`static Guardian.GuardContext` | `getThreadContext()` Obtain the GuardContext associated with the current thread.
`static void` | `heartbeat()` Issue a heartbeat on the GuardContext associated with the current thread.
`static void` | `heartbeat(long cMillis)` Issue a heartbeat of the specified duration on the GuardContext associated with the current thread.
`protected GuardSupport.Context` | `instantiateContext(Guardable guardable, long cMillis, float flPctRecover)`
`static void` | `logStackTraces()` Collect stack traces for all running threads and write them to the error log.
`void` | `release()` Release the Guardables managed by this GuardSupport.
`void` | `remove(Guardable guardable)` Remove the specified Guardable from the set of Guardables managed by this manager.
`protected void` | `setGuardableCount(int cGuardable)` Set the number of Guardables that are registered with this GuardSupport.
`protected void` | `setGuardContexts(GuardSupport.Context[] aGuardContext)` Set the array of GuardContext objects for the Guardables that are managed by this GuardSupport.
`protected void` | `setNextCheckTime(long ldtNextCheck)` Set the next time at which the Guardables should be checked.
`static void` | `setThreadContext(Guardian.GuardContext context)` Associate the specified GuardContext with the current thread.

Field Detail

### GUARDIAN_MAX_CHECK_INTERVAL

    public static final long GUARDIAN_MAX_CHECK_INTERVAL

  The maximum interval at which the Guardian thread should call check() to verify its guardables.
  See Also:
    Constant Field Values

### GUARDIAN_LATE_THRESHOLD

    protected static final long GUARDIAN_LATE_THRESHOLD

  The threshold past which a guardian considers itself late in checking its guardiables.
  See Also:
    Constant Field Values

### GUARDIAN_EARLY_THRESHOLD

    protected static final long GUARDIAN_EARLY_THRESHOLD

  The threshold before which than which a guardian considers itself early in checking its guardiables.
  See Also:
    Constant Field Values

### GUARDIAN_LOG_INTERVAL

    protected static final long GUARDIAN_LOG_INTERVAL

  The minimum interval at which the Guardian should log thread dumps.
  See Also:
    Constant Field Values

### m_aGuardContext

    protected GuardSupport.Context[] m_aGuardContext

  Array of GuardContexts for the registered Guardables. May contain nulls.

### m_cGuardable

    protected int m_cGuardable

  The number of registered Guardables.

### m_guardian

    protected Guardian m_guardian

  The Guardian that is managing this GuardSupport.

### m_ldtNextCheck

    protected long m_ldtNextCheck

  The next time at which the Guardables should be checked.

### m_tlContext

    protected static java.lang.ThreadLocal m_tlContext

  ThreadLocal containing the GuardContext associated with the current thread.

### s_atomicLogTime

    protected static AtomicCounter s_atomicLogTime

  Atomic counter containing the last log time stamp.

Constructor Detail

### GuardSupport

    public GuardSupport(Guardian guardian)

  Construct a GuardSupport for the specified Guardian.
  Parameters:
    `guardian` - the guardian managing this GuardSupport

Method Detail

### getGuardContexts

    protected GuardSupport.Context[] getGuardContexts()

  Return the array of GuardContext objects for the Guardables managed by this GuardSupport.
  Returns:
    the array of managed GuardContext objects

### setGuardContexts

    protected void setGuardContexts(GuardSupport.Context[] aGuardContext)

  Set the array of GuardContext objects for the Guardables that are managed by this GuardSupport.
  Parameters:
    `aGuardContext` - the array of managed GuardContext objects

### getGuardian

    protected Guardian getGuardian()

  Return the Guardian that manages this GuardSupport.
  Returns:
    the Guardian that manages this GuardSupport

### getNextCheckTime

    public long getNextCheckTime()

  Return the next time at which the Guardables should be checked.
  Returns:
    the next time at which the Guardables should be checked

### setNextCheckTime

    protected void setNextCheckTime(long ldtNextCheck)

  Set the next time at which the Guardables should be checked.
  Parameters:
    `ldtNextCheck` - the next time at which the Guardables should be checked

### add

    public Guardian.GuardContext add(Guardable guardable,
                                     long cMillis,
                                     float flPctRecover)

  Add the specified guardable to the set of Guardables managed by this manager, subject to the specified service parameters. If the specified guardable is already guarded by this manager, adjust the service parameters.
  Parameters:
    `guardable` - the Guardable object to be managed
    `cMillis` - the timeout for the specified Guardable
    `flPctRecover` - the percentage of the timeout after which to attempt recovery of the Guardable; 0 < flPctRecover &lteq; 1.0
  Returns:
    the GuardContext for the specified Guardable

### remove

    public void remove(Guardable guardable)

  Remove the specified Guardable from the set of Guardables managed by this manager.
  Parameters:
    `guardable` - the guardable to remove

### getGuardableCount

    public int getGuardableCount()

  Return the number of Guardables that are registered with this GuardSupport.
  Returns:
    the number of registered Guardable objects

### setGuardableCount

    protected void setGuardableCount(int cGuardable)

  Set the number of Guardables that are registered with this GuardSupport.
  Parameters:
    `cGuardable` - the number of registered Guardable objects

### check

    public long check()

  Check the registered Guardable objects for timeout, taking appropriate action and calculate the timestamp when the next check should be performed. The next check time can later be retrieved by the `getNextCheckTime()` method.
  Returns:
    the number of milliseconds past the time when the guardables should have been checked, or 0 if the check was performed on time

### release

    public void release()

  Release the Guardables managed by this GuardSupport. Releasing a Guardable causes it to no longer be guarded.

### instantiateContext

    protected GuardSupport.Context instantiateContext(Guardable guardable,
                                                      long cMillis,
                                                      float flPctRecover)

  Parameters:
    `guardable` - the Guardable object to be managed
    `cMillis` - the timeout for the specified Guardable
    `flPctRecover` - the percentage of the timeout after which to attempt recovery of the Guardable; 0 < flPctRecover &lteq; 1.0
  Returns:
    a Context for the specified guardable and SLA parameters

### getThreadContext

    public static Guardian.GuardContext getThreadContext()

  Obtain the GuardContext associated with the current thread.
  Returns:
    the GuardContext or null if it has not been set

### setThreadContext

    public static void setThreadContext(Guardian.GuardContext context)

  Associate the specified GuardContext with the current thread.
  Parameters:
    `context` - the GuardContext to associate with the current thread

### heartbeat

    public static void heartbeat()

  Issue a heartbeat on the GuardContext associated with the current thread.

### heartbeat

    public static void heartbeat(long cMillis)

  Issue a heartbeat of the specified duration on the GuardContext associated with the current thread.
  Parameters:
    `cMillis` - the number of milliseconds to heartbeat for

### logStackTraces

    public static void logStackTraces()

  Collect stack traces for all running threads and write them to the error log.

Skip navigation links

Overview | Package | Class | Tree | Index | Help
| Oracle® Coherence Java API Reference Release 3.6.1.0 E18814-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle and/or its affiliates. All rights reserved.