Class MockScheduler
- java.lang.Object
-
- org.opennms.netmgt.scheduler.mock.MockScheduler
-
- All Implemented Interfaces:
Scheduler
,ScheduleTimer
,Timer
public class MockScheduler extends java.lang.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 long
getCurrentTime()
This returns the current time for the schedulerjava.util.Map<java.lang.Long,java.util.List<ReadyRunnable>>
getEntries()
int
getEntryCount()
long
getNextTime()
long
getNumTasksExecuted()
Returns the total number of scheduled tasks (ReadyRunnables) that have been executed since the scheduler was initialized.int
getStatus()
Returns the current of this fiber.long
next()
void
pause()
Pauses the scheduler if it is current running.void
resume()
Resumes the scheduler if it has been paused.void
schedule(long interval, ReadyRunnable schedule)
schedulevoid
start()
Starts the fiber.void
stop()
Stops the fiber.long
tick(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:Scheduler
schedule
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:
schedule
in interfaceScheduler
- Specified by:
schedule
in interfaceScheduleTimer
- Parameters:
interval
- a long.schedule
- aReadyRunnable
object.
-
getEntryCount
public int getEntryCount()
-
getEntries
public java.util.Map<java.lang.Long,java.util.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:Scheduler
This returns the current time for the scheduler- Specified by:
getCurrentTime
in interfaceScheduler
- Specified by:
getCurrentTime
in interfaceTimer
- Returns:
- a long.
-
start
public void start()
Description copied from interface:Scheduler
Starts the fiber.
-
stop
public void stop()
Description copied from interface:Scheduler
Stops the fiber. If the fiber has never been run then an exception is generated.
-
pause
public void pause()
Description copied from interface:Scheduler
Pauses 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:Scheduler
Resumes 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:Scheduler
Returns the current of this fiber.
-
getNumTasksExecuted
public long getNumTasksExecuted()
Description copied from interface:Scheduler
Returns the total number of scheduled tasks (ReadyRunnables) that have been executed since the scheduler was initialized.- Specified by:
getNumTasksExecuted
in interfaceScheduler
- Returns:
- the number of task executed
-
-