|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TaskDependency
This interface represents a dependency of a task. It may be another task, a collection of other task, a source of outside events, etc.
The interface is extended by Task
and thus
implemented by all task classes. (Not by TaskFactory
:s, though.)
Implementation note: The task dependency implementation must be protected by its satisfied state lock so that a client doing the following will not miss any events:
Lock l = td.getSatisfiedStateLock(); l.lock(); { if (!td.isSatisfied()) { td.getDependencyObservable().add(this); } } finally { l.unlock(); }
Holding the satisfied state lock should be a prerequisite for acquiring the
implicit lock (synchronized
).
Method Summary | |
---|---|
Observable |
getDependencyObservable()
Observable that will fire with the dependency as argument when all dependencies are satisfied. |
Lock |
getSatisfiedStateLock()
Get the Lock that protects the dependency's satisfied
property. |
boolean |
isSatisfied()
Is this dependency satisfied? |
Method Detail |
---|
Observable getDependencyObservable()
Implementation note: The thread firing an event must own the satisfied state lock on the task dependency object.
Observable
to observe.boolean isSatisfied()
Implementation note: This method should be protected by the same
lock that can be retrieved by calling getSatisfiedStateLock()
.
true
if the dependency is satisfied.Lock getSatisfiedStateLock()
Lock
that protects the dependency's satisfied
property. This lock must be locked before the dependency's satisfied
state can be update.
An external class can lock this to ensure that the satisfied state is not updated while it holds the lock.
isSatisfied()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |