com.adventnet.adaptors
Class ProcessScheduler

java.lang.Object
  extended by com.adventnet.adaptors.ProcessScheduler

public class ProcessScheduler
extends java.lang.Object

This class is responsible for running list of threads at a specified interval. This class can be used to run a list of specified task to run at regular intervals.

Since:
Adaptor Framework Version 2.0
See Also:
com.adventnet.agent.utilities.scheduler.Scheduler

Method Summary
 void addProcess(java.lang.String id, java.lang.Runnable run)
          Adds a task to the list of tasks that will be executed at regualar intervals.
 int getMaxThreads()
          Returns the value of max threads.
 long getProcessInterval()
          Returns the time interval at which the listed process will be executed by the schedular
static ProcessScheduler getProcessScheduler(java.lang.String schedulerName)
          Factory method to create/get a ProcessScheduler object.
The processSchedular object is responsible for executing the list of threads added to the list using addProcess method
 void removeProcess(java.lang.String id)
          Removes a process from the list of tasks to be executed.
static void removeScheduler(java.lang.String schedulerName)
          This method removes the schedular and donot run any thread listed in its list
 void setMaxThreads(int maxThreads)
          Sets the value of max threads.
 void setProcessInterval(long time)
          Sets the time interval at which the listed process will be executed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getProcessScheduler

public static ProcessScheduler getProcessScheduler(java.lang.String schedulerName)
Factory method to create/get a ProcessScheduler object.
The processSchedular object is responsible for executing the list of threads added to the list using addProcess method


removeScheduler

public static void removeScheduler(java.lang.String schedulerName)
This method removes the schedular and donot run any thread listed in its list


getProcessInterval

public long getProcessInterval()
Returns the time interval at which the listed process will be executed by the schedular

Returns:
The Interval at which each thread will be executed.

setProcessInterval

public void setProcessInterval(long time)
Sets the time interval at which the listed process will be executed


getMaxThreads

public int getMaxThreads()
Returns the value of max threads. This represents the maximum number of threads that should exist at any given instance. By default, this is 4.

Returns:
The Maximum number of threads for scheduling the volatility threads.

setMaxThreads

public void setMaxThreads(int maxThreads)
Sets the value of max threads. This represents the maximum number of threads that should exist at any given instance.

Parameters:
maxThreads - The Maximum number of threads for scheduling the volatility threads.

addProcess

public void addProcess(java.lang.String id,
                       java.lang.Runnable run)
Adds a task to the list of tasks that will be executed at regualar intervals. It is the duty of the Runnable to check whether it is processing the previous invocation and act accordingly.


removeProcess

public void removeProcess(java.lang.String id)
Removes a process from the list of tasks to be executed.