Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.tangosol.net
Class GuardSupport.Context

    java.lang.Object
      com.tangosol.net.GuardSupport.Context

All Implemented Interfaces:
  Guardian.GuardContext

Enclosing class:
  GuardSupport

    protected class GuardSupport.Context

extends java.lang.Object
implements Guardian.GuardContext

Default implementation of GuardContext used by GuardSupport.

Field Summary
`protected long` | `m_cRecoveryMillis` The amount of time to allow for recovery
`protected long` | `m_cSoftTimeoutMillis` The soft-timeout interval to use for the represented Guardable.
`protected long` | `m_cTimeoutMillis` The timeout interval to use for the represented Guardable.
`protected boolean` | `m_fHeartbeatDefault` Was the last heartbeat issued on this context for the default interval? This property is only used by the guarded thread.
`protected float` | `m_flPctRecover` Percentage of the timeout after which to attempt recovery of the Guardable.
`protected Guardable` | `m_guardable` The Guardable represented by this GuardContext
`protected long` | `m_ldtLastMissedSoftTimeout` The soft-timeout stamp that was violated, resulting in a recovery attempt.
`protected long` | `m_ldtSoftTimeout` The next soft-timeout for the Guardable
`protected long` | `m_ldtTimeout` The next timeout for the Guardable.
`protected int` | `m_nState` The current state of the Context.

Fields inherited from interface com.tangosol.net.Guardian.GuardContext
`STATE_HEALTHY, STATE_RECOVERY, STATE_TERMINATING`

Constructor Summary
`protected` | `GuardSupport.Context(Guardable guardable, long cTimeoutMillis, float flPctRecover)` Construct the Context.

Method Summary
`protected void` | `doRecover()` Attempt recovery of the guardable.
`protected void` | `doTerminate()` Terminate the Guardable.
`protected Guardable` | `getGuardable()` Return the Guardable represented by this GuardContext.
`Guardian` | `getGuardian()` Return the Guardian for this context.
`protected long` | `getMissedSoftTimeout()` Return the last missed soft-timeout for this Guardable (that resulted in a recovery attempt).
`protected long` | `getRecoveryMillis()` Return the recovery interval for this Guardable.
`protected long` | `getSoftTimeout()` Return the next soft-timeout for this Guardable.
`long` | `getSoftTimeoutMillis()` Return the soft timeout interval for the represented Guardable.
`int` | `getState()` Return the state of the Guardable.
`protected long` | `getTimeout()` Return the next timeout for this Guardable.
`void` | `heartbeat()` 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.
`protected boolean` | `isSuspect(long ldtNow)` Is the Guardable represented by this GuardContext suspect (in danger of timing out soon).
`protected boolean` | `isTimedOut(long ldtNow)` Is the Guardable represented by this GuardContext timed out?
`void` | `release()` Release this context, causing the Guardian to discontinue monitoring of the represented Guardable.
`protected void` | `setMissedSoftTimeout(long ldtSoftTimeout)` Set the missed soft-timeout for this guardable.
`protected void` | `setRecoveryMillis(long cRecoveryMillis)` Set the recovery interval for this Guardable.
`protected void` | `setSoftTimeout(long ldtSoftTimeout)` Set the next soft-timeout for this Guardable.
`protected void` | `setState(int nState)` Set the state of the GuardContext to the specified value.
`protected void` | `setTimeout(long ldtTimeout)` Set the next timeout for this Guardable.
`java.lang.String` | `toString()` Return a human-readable description.

Field Detail

### m_nState

    protected volatile int m_nState

  The current state of the Context.

### m_fHeartbeatDefault

    protected boolean m_fHeartbeatDefault

  Was the last heartbeat issued on this context for the default interval? This property is only used by the guarded thread.

### m_ldtTimeout

    protected long m_ldtTimeout

  The next timeout for the Guardable. This property is only used by the guardian thread.

### m_cRecoveryMillis

    protected volatile long m_cRecoveryMillis

  The amount of time to allow for recovery

### m_ldtSoftTimeout

    protected volatile long m_ldtSoftTimeout

  The next soft-timeout for the Guardable

### m_guardable

    protected Guardable m_guardable

  The Guardable represented by this GuardContext

### m_cTimeoutMillis

    protected long m_cTimeoutMillis

  The timeout interval to use for the represented Guardable.

### m_cSoftTimeoutMillis

    protected long m_cSoftTimeoutMillis

  The soft-timeout interval to use for the represented Guardable.

### m_ldtLastMissedSoftTimeout

    protected long m_ldtLastMissedSoftTimeout

  The soft-timeout stamp that was violated, resulting in a recovery attempt.

### m_flPctRecover

    protected float m_flPctRecover

  Percentage of the timeout after which to attempt recovery of the Guardable.

Constructor Detail

### GuardSupport.Context

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

  Construct the Context.

  Parameters:
    `guardable` - the guardable represented by this Context
    `cTimeoutMillis` - the timeout interval for the specified Guardable
    `flPctRecover` - the percentage of the timeout after which to attempt recovery of the Guardable; 0 < flPctRecover <eq; 1.0

Method Detail

### getGuardable

    protected Guardable getGuardable()

  Return the Guardable represented by this GuardContext.

  Returns:
    the Guardable represented by this GuardContext

### setState

    protected void setState(int nState)

  Set the state of the GuardContext to the specified value.

  Parameters:
    `nState` - the state to set this GuardContext to

### getTimeout

    protected long getTimeout()

  Return the next timeout for this Guardable.

  Returns:
    the next timestamp, after which this Guardable should be considered timed out

### setTimeout

    protected void setTimeout(long ldtTimeout)

  Set the next timeout for this Guardable.

  Parameters:
    `ldtTimeout` - the next timestamp, after which this Guardable should be considered timed out

### getSoftTimeout

    protected long getSoftTimeout()

  Return the next soft-timeout for this Guardable. The soft-timeout is used to determine when to attempt recovery of the Guardable.

  Returns:
    the next timestamp, after which this Guardable should be considered suspect, and recovery attempted

### setSoftTimeout

    protected void setSoftTimeout(long ldtSoftTimeout)

  Set the next soft-timeout for this Guardable.

  Parameters:
    `ldtSoftTimeout` - the next timestamp, after which this Guardable should be considered suspect, and recovery attempted

### getRecoveryMillis

    protected long getRecoveryMillis()

  Return the recovery interval for this Guardable.

  Returns:
    the recovery interval for this Guardable

### setRecoveryMillis

    protected void setRecoveryMillis(long cRecoveryMillis)

  Set the recovery interval for this Guardable.

  Parameters:
    `cRecoveryMillis` - the recovery interval for this Guardable

### getMissedSoftTimeout

    protected long getMissedSoftTimeout()

  Return the last missed soft-timeout for this Guardable (that resulted in a recovery attempt).

  Returns:
    the last missed soft-timeout for this guardable

### setMissedSoftTimeout

    protected void setMissedSoftTimeout(long ldtSoftTimeout)

  Set the missed soft-timeout for this guardable.

  Parameters:
    `ldtSoftTimeout` - the soft-timeout that was missed

### isTimedOut

    protected boolean isTimedOut(long ldtNow)

  Is the Guardable represented by this GuardContext timed out?

  Parameters:
    `ldtNow` - the current timestamp
  Returns:
    true iff the represented Guardable is timed out

### isSuspect

    protected boolean isSuspect(long ldtNow)

  Is the Guardable represented by this GuardContext suspect (in danger of timing out soon).

  Parameters:
    `ldtNow` - the current timestamp
  Returns:
    true iff the represented Guardable is suspect

### toString

    public java.lang.String toString()

  Return a human-readable description.

  Returns:
    a human-readable description

### getGuardian

    public Guardian getGuardian()

  Return the Guardian for this context.

  Specified by:
    `getGuardian` in interface `Guardian.GuardContext`
  Returns:
    the Guardian for this context

### heartbeat

    public void heartbeat()

  Called by the Guardable to signal that it is still alive.

  Specified by:
    `heartbeat` in interface `Guardian.GuardContext`

### heartbeat

    public 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.

  Specified by:
    `heartbeat` in interface `Guardian.GuardContext`
  Parameters:
    `cMillis` - the number of milliseconds for which the guardable should not be considered timed out

### getState

    public int getState()

  Return the state of the Guardable. Valid values are STATE_* constants.

  Specified by:
    `getState` in interface `Guardian.GuardContext`
  Returns:
    the state of the Guardable

### release

    public void release()

  Release this context, causing the Guardian to discontinue monitoring of the represented Guardable.

  Specified by:
    `release` in interface `Guardian.GuardContext`

### getSoftTimeoutMillis

    public 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.

  Specified by:
    `getSoftTimeoutMillis` in interface `Guardian.GuardContext`
  Returns:
    the soft timeout interval for the represented Guardable

### doRecover

    protected void doRecover()

  Attempt recovery of the guardable.

### doTerminate

    protected void doTerminate()

  Terminate the Guardable.

Overview | Package | Class | Tree | Index | Help

Oracle® Coherence Java API Reference
v3.5.3
E15583-01
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2000, 2010, Oracle. All rights reserved.