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

java.lang.Object
  extended by 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. The monitor may check the guard at arbitrary times from any thread occupying the monitor, so code should not be written to rely on how often a guard might or might not be checked.

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. This method is always called with the associated monitor already occupied. Implementations of this method must depend only on state protected by the associated monitor, and must not modify that state.


equals

public final boolean equals(Object other)
Overrides:
equals in class Object

hashCode

public final int hashCode()
Overrides:
hashCode in class Object


Copyright © 2010-2012. All Rights Reserved.