net.sourceforge.basher.impl
Class SchedulerImpl

java.lang.Object
  extended by net.sourceforge.basher.impl.SchedulerImpl
All Implemented Interfaces:
EventListener, BasherEventListener, Scheduler

public class SchedulerImpl
extends Object
implements Scheduler, BasherEventListener

Implementation of the Scheduler interface.

Version:
1.0
Author:
Johan Lindquist

Constructor Summary
SchedulerImpl()
           
 
Method Summary
 void addThread()
          Adds a thread to the currently running scheduler.
 void addThreads(int numToAdd)
          Adds the specified number of threads to the currently running scheduler.
 void basherEvent(BasherEvent basherEvent)
           
 Phase getCurrentPhase()
          Removes a thread from the currently running scheduler
 int getNumberOfActiveThreads()
          Retrieves the number of threads currently active in the scheduler.
 boolean isRunning()
          Checks whether or not the scheduler is running.
 void removeAllThreads()
          Removes all threads from the currently running scheduler
 void removeThread()
          Removes a thread from the currently running scheduler
 void setContextManager(ContextManager contextManager)
          Sets the context manager instance to use
 void setEventManager(EventManager eventManager)
          Sets the event manager to use
 void setLog(org.apache.commons.logging.Log logger)
          Sets the logging instance to use
 void setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService)
           
 void setTaskRunner(TaskRunner taskRunner)
          Sets the task runner to use
 void setThreadIncrementTask(ThreadIncrementTask threadIncrementTask)
           
 void setTickTimerTask(TickTimerTask tickTimerTask)
           
 void start()
          Starts the scheduler.
 void start(BasherContext basherContext)
           
 void start(String contextName)
           
 void stop()
          Stops the scheduler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchedulerImpl

public SchedulerImpl()
Method Detail

addThread

public void addThread()
Adds a thread to the currently running scheduler.

Specified by:
addThread in interface Scheduler

addThreads

public void addThreads(int numToAdd)
Adds the specified number of threads to the currently running scheduler.

Specified by:
addThreads in interface Scheduler
Parameters:
numToAdd - The number of threads to add

removeThread

public void removeThread()
Removes a thread from the currently running scheduler

Specified by:
removeThread in interface Scheduler

removeAllThreads

public void removeAllThreads()
Removes all threads from the currently running scheduler

Specified by:
removeAllThreads in interface Scheduler

stop

public void stop()
Stops the scheduler.

Specified by:
stop in interface Scheduler

start

public void start()
Starts the scheduler.

Specified by:
start in interface Scheduler

start

public void start(String contextName)
Specified by:
start in interface Scheduler

start

public void start(BasherContext basherContext)
Specified by:
start in interface Scheduler

getNumberOfActiveThreads

public int getNumberOfActiveThreads()
Retrieves the number of threads currently active in the scheduler.

Specified by:
getNumberOfActiveThreads in interface Scheduler
Returns:
The number of currently active threads

isRunning

public boolean isRunning()
Checks whether or not the scheduler is running.

Specified by:
isRunning in interface Scheduler
Returns:
True if the scheduler is running, otherwise false.

getCurrentPhase

public Phase getCurrentPhase()
Description copied from interface: Scheduler
Removes a thread from the currently running scheduler

Specified by:
getCurrentPhase in interface Scheduler

setLog

public void setLog(org.apache.commons.logging.Log logger)
Sets the logging instance to use

Parameters:
logger - The logging instance to use

setContextManager

public void setContextManager(ContextManager contextManager)
Sets the context manager instance to use

Parameters:
contextManager - The context manager instance to use

setEventManager

public void setEventManager(EventManager eventManager)
Sets the event manager to use

Parameters:
eventManager - The event manager instance to use

setTaskRunner

public void setTaskRunner(TaskRunner taskRunner)
Sets the task runner to use

Parameters:
taskRunner - The task runner instance to use

setTickTimerTask

public void setTickTimerTask(TickTimerTask tickTimerTask)

setThreadIncrementTask

public void setThreadIncrementTask(ThreadIncrementTask threadIncrementTask)

setScheduledExecutorService

public void setScheduledExecutorService(ScheduledExecutorService scheduledExecutorService)

basherEvent

public void basherEvent(BasherEvent basherEvent)
Specified by:
basherEvent in interface BasherEventListener


Copyright © 2006-2010 Basher Team. All Rights Reserved.