Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.google.common.util.concurrent
Class Monitor.Guard

    java.lang.Object
      com.google.common.util.concurrent.Monitor.Guard

Enclosing class:
  Monitor

    @Beta
    public abstract static class Monitor.Guard

extends Object

A boolean condition for which a thread may wait. A `Guard` is associated with a single `Monitor`.

An implementation of this interface must ensure the following:

- Calling `isSatisfied()` must be thread-safe with its monitor occupied, because the monitor may check the guard at arbitrary times from a thread occupying the monitor.
- Calling `isSatisfied()` must not itself have the effect of altering the return value of this or any other guard's `isSatisfied()` method.
- No thread that is not occupying the monitor may cause the value returned by `isSatisfied()` to change from true to false.
- If any thread that is not occupying the monitor causes the value returned by `isSatisfied()` to change from false to true, `Monitor.reevaluateGuards()` must be called in order to notify any waiting threads.

If a `Guard` is passed into any method of a `Monitor` other than the one it is associated with, an `IllegalMonitorStateException` is thrown.

Since:
  10.0

Constructor Summary
`protected` | `Monitor.Guard(Monitor monitor)`

Method Summary
`boolean` | `equals(Object other)`
`int` | `hashCode()`
`abstract boolean` | `isSatisfied()` Evaluates this guard's boolean condition.

Methods inherited from class java.lang.Object
`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### Monitor.Guard

    protected Monitor.Guard(Monitor monitor)

Method Detail

### isSatisfied

    public abstract boolean isSatisfied()

  Evaluates this guard's boolean condition.

### equals

    public final boolean equals(Object other)

  Overrides:
    `equals` in class `Object`

### hashCode

    public final int hashCode()

  Overrides:
    `hashCode` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2010-2011. All Rights Reserved.