Class Monitor.Guard
java.lang.Object
com.google.common.util.concurrent.Monitor.Guard
- Direct Known Subclasses:
AbstractService.HasReachedRunningGuard
,AbstractService.IsStartableGuard
,AbstractService.IsStoppableGuard
,AbstractService.IsStoppedGuard
,ServiceManager.ServiceManagerState.AwaitHealthGuard
,ServiceManager.ServiceManagerState.StoppedGuard
- Enclosing class:
Monitor
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
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) final Condition
(package private) final Monitor
(package private) Monitor.Guard
The next active guard(package private) int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract boolean
Evaluates this guard's boolean condition.
-
Field Details
-
monitor
-
condition
-
waiterCount
int waiterCount -
next
The next active guard
-
-
Constructor Details
-
Guard
-
-
Method Details
-
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.
-