|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.opennms.netmgt.scheduler.LegacyScheduler
public class LegacyScheduler
This class implements a simple scheduler to ensure the polling occurs at the expected intervals. The scheduler employees a dynamic thread pool that adjust to the load until a maximum thread count is reached.
| Nested Class Summary | |
|---|---|
static class |
LegacyScheduler.PeekableFifoQueue<T>
This queue extends the standard FIFO queue instance so that it is possible to peek at an instance without removing it from the queue. |
| Field Summary |
|---|
| Fields inherited from interface org.opennms.core.fiber.PausableFiber |
|---|
PAUSE_PENDING, PAUSED, RESUME_PENDING |
| Fields inherited from interface org.opennms.core.fiber.Fiber |
|---|
RUNNING, START_PENDING, STARTING, STATUS_NAMES, STOP_PENDING, STOPPED |
| Constructor Summary | |
|---|---|
LegacyScheduler(String parent,
int maxSize)
Constructs a new instance of the scheduler. |
|
LegacyScheduler(String parent,
int maxSize,
float lowMark,
float hiMark)
Constructs a new instance of the scheduler. |
|
| Method Summary | |
|---|---|
long |
getCurrentTime()
This returns the current time for the scheduler |
String |
getName()
Returns the name of this fiber. |
RunnableConsumerThreadPool |
getRunner()
Returns the pool of threads that are used to executed the runnable instances scheduled by the class' instance. |
int |
getScheduled()
Returns total number of elements currently scheduled. |
int |
getStatus()
Returns the current of this fiber. |
void |
pause()
Pauses the scheduler if it is current running. |
void |
resume()
Resumes the scheduler if it has been paused. |
void |
run()
The main method of the scheduler. |
void |
schedule(long interval,
ReadyRunnable runnable)
This method is used to schedule a ready runnable in the system. |
void |
schedule(ReadyRunnable runnable,
long interval)
This method is used to schedule a ready runnable in the system. |
void |
start()
Starts the fiber. |
void |
stop()
Stops the fiber. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LegacyScheduler(String parent,
int maxSize)
parent - String prepended to "Scheduler" to create fiber namemaxSize - The maximum size of the thread pool.
public LegacyScheduler(String parent,
int maxSize,
float lowMark,
float hiMark)
parent - String prepended to "Scheduler" to create fiber namemaxSize - The maximum size of the thread pool.lowMark - The low water mark ratios of thread size to threads when
threads are stopped.hiMark - The high water mark ratio of thread size to threads when
threads are started.| Method Detail |
|---|
public void schedule(ReadyRunnable runnable,
long interval)
runnable - The element to run when interval expires.interval - The queue to add the runnable to.
RuntimeException - Thrown if an error occurs adding the element to the queue.
public void schedule(long interval,
ReadyRunnable runnable)
Scheduler
schedule in interface Schedulerschedule in interface ScheduleTimerinterval - The queue to add the runnable to.runnable - The element to run when interval expires.public long getCurrentTime()
Scheduler
getCurrentTime in interface SchedulergetCurrentTime in interface Timerpublic void start()
Scheduler
start in interface Fiberstart in interface Schedulerpublic void stop()
Scheduler
stop in interface Fiberstop in interface Schedulerpublic void pause()
Scheduler
pause in interface PausableFiberpause in interface Schedulerpublic void resume()
Scheduler
resume in interface PausableFiberresume in interface Schedulerpublic int getStatus()
Scheduler
getStatus in interface FibergetStatus in interface Schedulerpublic String getName()
getName in interface Fiberpublic int getScheduled()
public RunnableConsumerThreadPool getRunner()
public void run()
run in interface Runnable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||