org.gridbus.broker.scheduler
Class Scheduler

java.lang.Object
  extended by org.gridbus.broker.scheduler.Scheduler
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
DataScheduler, DataSchedulerOld, DBScheduler, RoundRobinScheduler

public abstract class Scheduler
extends java.lang.Object
implements java.lang.Runnable

This is the base scheduler class, and contains main methods for performing the scheduling/

Version:
2.0
Author:
Srikumar Venugopal (srikumar@cs.mu.oz.au)

Constructor Summary
Scheduler(GridbusFarmingEngine fe)
          Constructor for the Scheduler
 
Method Summary
 java.lang.String getAlgorithm()
           
 java.util.Collection getJobs()
           
 int getPollTime()
           
 java.util.Collection getServers()
          Get the latest servers collection everytime from the farming engine.
 java.lang.String getStats()
           
 boolean isClassValid()
          Returns if the current class is a valid one.
 boolean isFailed()
           
 boolean isFeasible()
           
 boolean isFinished()
          Returns whether the scheduling is finished.
 void printStats()
           
 void recoverStats()
          This method re-initialises the scheduler stats, when the broker is recovering from a crash.
 void run()
          The run method enables the scheduler to run as a seperate thread, and calls the 'schedule()' method.
abstract  void schedule()
          Abstract method: schedule to be implemented by derived classes which implement various scheduling algorithms.
 void setAlgorithm(java.lang.String type)
           
 void setFailed(boolean failed)
           
 void setFeasible(boolean feasible)
           
 void setFinished(boolean b)
          Sets the 'finished' state of the scheduler.
 void setPollTime(int pollTime)
           
 void sortByCost(java.util.Vector server_vect)
          Sorts the compute server list by cost
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Scheduler

public Scheduler(GridbusFarmingEngine fe)
Constructor for the Scheduler

Parameters:
as - - ActiveSet
Method Detail

sortByCost

public void sortByCost(java.util.Vector server_vect)
Sorts the compute server list by cost

Parameters:
server_vect -

recoverStats

public final void recoverStats()
This method re-initialises the scheduler stats, when the broker is recovering from a crash.


getStats

public final java.lang.String getStats()
Returns:
Stats formatted as a string

printStats

public final void printStats()

run

public final void run()
The run method enables the scheduler to run as a seperate thread, and calls the 'schedule()' method.

Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

isFailed

public boolean isFailed()
Returns:
Returns the failed.

setFailed

public void setFailed(boolean failed)
Parameters:
failed - The failed to set.

isClassValid

public boolean isClassValid()
Returns if the current class is a valid one. This is used to avoid class loader problems with Tomcat.

Returns:
boolean

schedule

public abstract void schedule()
Abstract method: schedule to be implemented by derived classes which implement various scheduling algorithms.


isFinished

public boolean isFinished()
Returns whether the scheduling is finished.

Returns:
boolean

setFinished

public void setFinished(boolean b)
Sets the 'finished' state of the scheduler.

Parameters:
b - - boolean

getServers

public java.util.Collection getServers()
Get the latest servers collection everytime from the farming engine. (So that servers can be added / removed from the farming engine dynamically).

Returns:

getJobs

public java.util.Collection getJobs()
Returns:

getAlgorithm

public java.lang.String getAlgorithm()
Returns:

setAlgorithm

public void setAlgorithm(java.lang.String type)
Parameters:
type -

getPollTime

public int getPollTime()
Returns:
Returns the pollTime.

setPollTime

public void setPollTime(int pollTime)
Parameters:
pollTime - The pollTime to set.

isFeasible

public boolean isFeasible()
Returns:
Returns the feasible.

setFeasible

public void setFeasible(boolean feasible)
Parameters:
feasible - The feasible to set.