com.faunos.util.cc
Class SchedulingService
java.lang.Object
com.faunos.util.cc.SchedulingService
- Direct Known Subclasses:
- Environment
public class SchedulingService
- extends Object
An execution environment using the Scheduler
idiom.
- Author:
- Babak Farhang
- See Also:
Scheduler
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SchedulingService
public SchedulingService()
getMaxThreadPoolSize
public int getMaxThreadPoolSize()
setMaxThreadPoolSize
public void setMaxThreadPoolSize(int size)
addScheduler
public void addScheduler(Scheduler scheduler)
signalWorkAvailable
public void signalWorkAvailable(Scheduler scheduler)
shutdown
public void shutdown()
waitPeriodMillis
protected int waitPeriodMillis(int inProgress,
int newlyScheduled)
- Returns the period the scheduling thread waits before attempting to
schedule more work. This implementation returns 1 second if nothing was
scheduled, and 5 seconds, o.w.; the
inProgress
parameter
is ignored by the base class.
- Parameters:
inProgress
- the number of in progress tasksnewlyScheduled
- the number of newly scheduled tasks
- Returns:
- the number of milliseconds to wait
getThreadPoolSize
protected int getThreadPoolSize(int schedulerCount)
- Returns the number of threads the pool will maintain given the
specified number of schedulers.
(The actual number of threads will be bounded by
the max thread pool size property.)
- Returns:
- the base implementation just returns
schedulerCount
.