Class MockScheduler
- java.lang.Object
-
- org.opennms.netmgt.scheduler.mock.MockScheduler
-
- All Implemented Interfaces:
Scheduler,ScheduleTimer,Timer
public class MockScheduler extends Object implements Scheduler
-
-
Constructor Summary
Constructors Constructor Description MockScheduler()MockScheduler(MockTimer timer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longgetCurrentTime()This returns the current time for the schedulerMap<Long,List<ReadyRunnable>>getEntries()intgetEntryCount()longgetNextTime()longgetNumTasksExecuted()Returns the total number of scheduled tasks (ReadyRunnables) that have been executed since the scheduler was initialized.intgetStatus()Returns the current of this fiber.longnext()voidpause()Pauses the scheduler if it is current running.voidresume()Resumes the scheduler if it has been paused.voidschedule(long interval, ReadyRunnable schedule)schedulevoidstart()Starts the fiber.voidstop()Stops the fiber.longtick(int step)
-
-
-
Constructor Detail
-
MockScheduler
public MockScheduler()
-
MockScheduler
public MockScheduler(MockTimer timer)
-
-
Method Detail
-
schedule
public void schedule(long interval, ReadyRunnable schedule)Description copied from interface:Schedulerschedule
This method is used to schedule a ready runnable in the system. The interval is used as the key for determining which queue to add the runnable.- Specified by:
schedulein interfaceScheduler- Specified by:
schedulein interfaceScheduleTimer- Parameters:
interval- a long.schedule- aReadyRunnableobject.
-
getEntryCount
public int getEntryCount()
-
getEntries
public Map<Long,List<ReadyRunnable>> getEntries()
-
getNextTime
public long getNextTime()
-
next
public long next()
-
tick
public long tick(int step)
-
getCurrentTime
public long getCurrentTime()
Description copied from interface:SchedulerThis returns the current time for the scheduler- Specified by:
getCurrentTimein interfaceScheduler- Specified by:
getCurrentTimein interfaceTimer- Returns:
- a long.
-
start
public void start()
Description copied from interface:SchedulerStarts the fiber.
-
stop
public void stop()
Description copied from interface:SchedulerStops the fiber. If the fiber has never been run then an exception is generated.
-
pause
public void pause()
Description copied from interface:SchedulerPauses the scheduler if it is current running. If the fiber has not been run or has already stopped then an exception is generated.
-
resume
public void resume()
Description copied from interface:SchedulerResumes the scheduler if it has been paused. If the fiber has not been run or has already stopped then an exception is generated.
-
getStatus
public int getStatus()
Description copied from interface:SchedulerReturns the current of this fiber.
-
getNumTasksExecuted
public long getNumTasksExecuted()
Description copied from interface:SchedulerReturns the total number of scheduled tasks (ReadyRunnables) that have been executed since the scheduler was initialized.- Specified by:
getNumTasksExecutedin interfaceScheduler- Returns:
- the number of task executed
-
-