|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.faunos.util.cc.CompoundScheduler
public class CompoundScheduler
A contraption for packing a bunch of Scheduler
s
together as one scheduler. This allows running a group of
schedulers in a same thread.
Field Summary | |
---|---|
protected List<Scheduler> |
schedulers
The internal list of schedulers. |
Constructor Summary | |
---|---|
CompoundScheduler()
|
Method Summary | |
---|---|
void |
addScheduler(Scheduler scheduler)
Adds the given scheduler . |
int |
inProgressCount()
Returns the aggregate number of tasks in progress as computed in the last invocation of the schedule() method. |
protected void |
removeSchedulers(Collection<Scheduler> deadSchedulers)
Callback invoked by the schedule() method. |
int |
schedule(ExecutorService service)
Schedules background tasks on the given service and
returns the aggregate number of tasks scheduled. |
int |
size()
Returns the number of internal schedulers that remain in this compound instance. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final List<Scheduler> schedulers
synchronized (this) { if (schedulers.isEmpty()) .. }
Constructor Detail |
---|
public CompoundScheduler()
Method Detail |
---|
public int inProgressCount()
schedule()
method.
inProgressCount
in interface Scheduler
public int schedule(ExecutorService service)
service
and
returns the aggregate number of tasks scheduled. This scheduler never
returns -1.
schedule
in interface Scheduler
public void addScheduler(Scheduler scheduler)
scheduler
. The scheduler
is assumed not to be already added; o.w. the behavior is
undefined (haven't thought about it).
public int size()
protected void removeSchedulers(Collection<Scheduler> deadSchedulers)
schedule()
method.
deadSchedulers
- the set of schedulers that returned -1
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |