com.adventnet.utils.agent
Class ThreadScheduler

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--com.adventnet.utils.agent.ThreadScheduler

public class ThreadScheduler
extends java.lang.Thread

This Class is to schedule the Threads when The Agent is in Asynchronous mode.


Field Summary
(package private)  java.util.Vector holders
           
(package private)  int MAX_THREADS
           
(package private)  SnmpPduRequestListener pduRequestHandler
           
(package private)  java.util.Vector ready_events
           
(package private)  java.util.Vector requestEvents
           
(package private)  boolean STOP
           
(package private)  int STOPPED_THREADS
           
(package private)  int TOTAL_THREADS
           
(package private)  java.util.Vector waitThreads
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY, values
 
Constructor Summary
ThreadScheduler(java.lang.String name)
          The Constructor for Thread Scheduler with the String name.
 
Method Summary
 boolean clearThreads()
          This method is for clearing all the Threads in the Scheduler.
 int getMaxThreads()
          Getter for the Maximum Number of Threads allowed by the Scheduler.
(package private)  SnmpPduRequestEvent getNextEvent()
           
 SnmpPduRequestEvent getTheWork()
          This Method is to collectr the Work to be scheduled.
(package private)  void putInWaitMode(HolderThread holder)
           
 void run()
          This method is to run- kicking off the Agent.
(package private)  void runTask(SnmpPduRequestEvent event)
           
 void scheduleEvent(SnmpPduRequestEvent event)
          Method to schedule the given Event.
 boolean setMaxThreads(int m)
          Setter for the Maximum Number of Threads The Maximum limit is 20
 void setPduListener(SnmpPduRequestListener l)
          Method to set the PduListener for this class.
(package private)  void startHolderThreads()
           
 boolean STOP_THIS()
          Method to stop.
 
Methods inherited from class java.lang.Thread
, activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_THREADS

int MAX_THREADS

TOTAL_THREADS

int TOTAL_THREADS

STOPPED_THREADS

int STOPPED_THREADS

STOP

boolean STOP

requestEvents

java.util.Vector requestEvents

holders

java.util.Vector holders

ready_events

java.util.Vector ready_events

waitThreads

java.util.Vector waitThreads

pduRequestHandler

SnmpPduRequestListener pduRequestHandler
Constructor Detail

ThreadScheduler

public ThreadScheduler(java.lang.String name)
The Constructor for Thread Scheduler with the String name.
Parameters:
name - The name for the Thread Scheduler.
Method Detail

getMaxThreads

public int getMaxThreads()
Getter for the Maximum Number of Threads allowed by the Scheduler.
Returns:
The Maximum Number of Threads scheduled.

STOP_THIS

public boolean STOP_THIS()
Method to stop.
Returns:
true on success

setMaxThreads

public boolean setMaxThreads(int m)
Setter for the Maximum Number of Threads The Maximum limit is 20
Parameters:
m - The int specifying the number of Threads
Returns:
true if set else a false

setPduListener

public void setPduListener(SnmpPduRequestListener l)
Method to set the PduListener for this class.
Parameters:
l - The SnmpPduRequestListener to be set.

scheduleEvent

public void scheduleEvent(SnmpPduRequestEvent event)
Method to schedule the given Event.
Parameters:
event - The SnmpPduRequestEvent to be scheduled.

getTheWork

public SnmpPduRequestEvent getTheWork()
This Method is to collectr the Work to be scheduled.
Returns:
The SnmpPduRequestEvent that is collected.

run

public void run()
This method is to run- kicking off the Agent.
Overrides:
run in class java.lang.Thread

putInWaitMode

void putInWaitMode(HolderThread holder)

runTask

void runTask(SnmpPduRequestEvent event)

getNextEvent

SnmpPduRequestEvent getNextEvent()

clearThreads

public boolean clearThreads()
This method is for clearing all the Threads in the Scheduler.
Returns:
true when all the Threads are stopped.

startHolderThreads

void startHolderThreads()