T
- public class Forker<T>
extends java.lang.Object
doWhen(Collection, Object, Runnable)
. The collection is
the list of dependencies, the object is the target, and the runnable is run
to update the target. The runnable will only run when all its dependencies
have ran their associated runnable.Modifier and Type | Class and Description |
---|---|
(package private) class |
Forker.Job
Helper class to model a Job
|
Modifier and Type | Field and Description |
---|---|
(package private) java.util.concurrent.atomic.AtomicBoolean |
canceled |
private int |
count |
(package private) java.util.Set<Forker.Job> |
executing |
(package private) java.util.concurrent.Executor |
executor |
(package private) java.util.Map<T,Forker.Job> |
waiting |
Constructor and Description |
---|
Forker()
Constructor
|
Forker(java.util.concurrent.Executor executor)
Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
cancel(long ms)
Cancel the forker.
|
private void |
check() |
(package private) void |
done(Forker.Job done)
Called when the target has ran by the Job.
|
void |
doWhen(java.util.Collection<? extends T> dependencies,
T target,
java.lang.Runnable runnable)
Schedule a job for execution when the dependencies are done of target are
done.
|
int |
getCount() |
private void |
schedule() |
void |
start(long ms) |
void |
sync(long ms) |
final java.util.concurrent.Executor executor
final java.util.Map<T,Forker.Job> waiting
final java.util.Set<Forker.Job> executing
final java.util.concurrent.atomic.AtomicBoolean canceled
private int count
public Forker(java.util.concurrent.Executor executor)
executor
- public Forker()
public void doWhen(java.util.Collection<? extends T> dependencies, T target, java.lang.Runnable runnable)
dependencies
- the dependencies that must have runtarget
- the target, is removed from all the dependencies when it
ranrunnable
- the runnable to runpublic void start(long ms) throws java.lang.InterruptedException
java.lang.InterruptedException
private void check()
public void sync(long ms) throws java.lang.InterruptedException
java.lang.InterruptedException
private void schedule()
void done(Forker.Job done)
done
- public void cancel(long ms) throws java.lang.InterruptedException
java.lang.InterruptedException
public int getCount()