Class LockGuardedDrivenValue<T>
java.lang.Object
com.inductiveautomation.perspective.gateway.driven.LockGuardedDrivenValue<T>
- Type Parameters:
T- The type of the driven value
- All Implemented Interfaces:
DrivenValue<T>
- Direct Known Subclasses:
ExpressionDrivenValue,LockGuardedDrivenValueCollection
A LockGuardedDrivenValue is a
DrivenValue which holds a lock object and asserts that Threads which call
isReady(), isDirty(), and getAndClear() hold this lock. Client code must synchronize on
the lock before calling any of these methods.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionFetch the current driven valueCalled after asserting that the calling thread holds the injected lock.booleanisDirty()protected abstract booleanCalled after asserting that the calling thread holds the injected lock.booleanisReady()protected abstract booleanCalled after asserting that the calling thread holds the injected lock.Call before startup() to resolve and collect any references this value might depend on.protected abstract Collection<PropertyReference>Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.inductiveautomation.perspective.gateway.driven.DrivenValue
shutdown, startup
-
Field Details
-
lock
-
-
Constructor Details
-
LockGuardedDrivenValue
-
-
Method Details
-
isReadyInternal
protected abstract boolean isReadyInternal()Called after asserting that the calling thread holds the injected lock.- See Also:
-
isReady
public boolean isReady()- Specified by:
isReadyin interfaceDrivenValue<T>- Returns:
- true if the driven value is ready to fetch
-
isDirtyInternal
protected abstract boolean isDirtyInternal()Called after asserting that the calling thread holds the injected lock.- See Also:
-
isDirty
public boolean isDirty()- Specified by:
isDirtyin interfaceDrivenValue<T>- Returns:
- true if the driven value has changed since the last time it was fetched
-
resolveReferencesInternal
-
resolveReferences
Description copied from interface:DrivenValueCall before startup() to resolve and collect any references this value might depend on.- Specified by:
resolveReferencesin interfaceDrivenValue<T>
-
getAndClearInternal
Called after asserting that the calling thread holds the injected lock.- See Also:
-
getAndClear
Description copied from interface:DrivenValueFetch the current driven value- Specified by:
getAndClearin interfaceDrivenValue<T>- Returns:
- An
Optionalcontaining the current driven value, if present, or an empty Optional if the driven value is null / not present.
-