org.globus.cog.karajan.scheduler
Class AbstractScheduler

java.lang.Object
  extended by java.lang.Thread
      extended by org.globus.cog.karajan.scheduler.AbstractScheduler
All Implemented Interfaces:
Runnable, Scheduler
Direct Known Subclasses:
LateBindingScheduler, StaticContactListScheduler

public abstract class AbstractScheduler
extends Thread
implements Scheduler


Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
static String[] propertyNames
           
static int THROTTLE_OFF
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AbstractScheduler()
           
 
Method Summary
 void addFailureHandler(FailureHandler handler)
          Allows handling task failures at the scheduler level
 void addJobStatusListener(StatusListener l, Task task)
          Allows the addition of a status listener that will be invoked whenever the status of the given task changes.
 void addTaskHandler(TaskHandlerWrapper taskHandler)
          Makes the scheduler aware of a task handler implementation.
 void addTaskTransformer(TaskTransformer taskTransformer)
          Adds a task transformer to this scheduler.
protected  void applyTaskTransformers(Task t, Contact[] contacts, Service[] services)
           
protected  boolean checkConstraints(BoundContact resource, TaskConstraints tc)
           
protected  List checkConstraints(List resources, TaskConstraints tc)
           
static String[] combineNames(String[] first, String[] last)
           
 void fireJobStatusChangeEvent(StatusEvent e)
           
 void fireJobStatusChangeEvent(Task source, Status status)
           
 ResourceConstraintChecker getConstraintChecker()
           
protected  Object getConstraints(Task task)
           
 Queue getJobQueue()
           
 int getMaxSimultaneousJobs()
           
 Object getProperty(String name)
           
 String[] getPropertyNames()
           
 ContactSet getResources()
          Returns the set of resources that the scheduler knows about
 TaskHandlerWrapper getTaskHadlerWrapper(int index)
           
 List getTaskHandlers()
          Returns a list of all the task handlers that were added to the scheduler
 TaskHandlerWrapper getTaskHandlerWrapper(int type, String provider)
           
 Collection getTaskHandlerWrappers(int type)
           
 List getTaskTransformers()
           
protected  void removeConstraints(Task task)
           
 void removeJobStatusListener(StatusListener l, Task task)
          Removes a status listener added using addJobStatusListener
protected  boolean runFailureHandlers(Task t)
           
 void setConstraintChecker(ResourceConstraintChecker constraintChecker)
           
protected  void setConstraints(Task task, Object constraint)
           
 void setMaxSimultaneousJobs(int i)
           
 void setProperty(String name, Object value)
          Sets a scheduler property.
 void setResources(ContactSet grid)
          Sets the set of resources that the scheduler will use
 void setTaskHandlers(List taskHandlers)
           
protected  int throttleValue(Object value)
           
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, run, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, 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
 
Methods inherited from interface org.globus.cog.karajan.scheduler.Scheduler
allocateContact, allocateContact, cancelTask, enqueue, releaseContact
 

Field Detail

THROTTLE_OFF

public static final int THROTTLE_OFF
See Also:
Constant Field Values

propertyNames

public static final String[] propertyNames
Constructor Detail

AbstractScheduler

public AbstractScheduler()
Method Detail

addTaskHandler

public final void addTaskHandler(TaskHandlerWrapper taskHandler)
Description copied from interface: Scheduler
Makes the scheduler aware of a task handler implementation. The scheduler can then make use of any of the task handlers that were added.

Specified by:
addTaskHandler in interface Scheduler
See Also:
TaskHandlerWrapper

getTaskHandlers

public List getTaskHandlers()
Description copied from interface: Scheduler
Returns a list of all the task handlers that were added to the scheduler

Specified by:
getTaskHandlers in interface Scheduler

setTaskHandlers

public void setTaskHandlers(List taskHandlers)

getTaskHadlerWrapper

public TaskHandlerWrapper getTaskHadlerWrapper(int index)

getTaskHandlerWrappers

public Collection getTaskHandlerWrappers(int type)

getTaskHandlerWrapper

public TaskHandlerWrapper getTaskHandlerWrapper(int type,
                                                String provider)

setResources

public void setResources(ContactSet grid)
Description copied from interface: Scheduler
Sets the set of resources that the scheduler will use

Specified by:
setResources in interface Scheduler
See Also:
ContactSet

getResources

public ContactSet getResources()
Description copied from interface: Scheduler
Returns the set of resources that the scheduler knows about

Specified by:
getResources in interface Scheduler

addJobStatusListener

public void addJobStatusListener(StatusListener l,
                                 Task task)
Description copied from interface: Scheduler
Allows the addition of a status listener that will be invoked whenever the status of the given task changes.

Specified by:
addJobStatusListener in interface Scheduler

removeJobStatusListener

public void removeJobStatusListener(StatusListener l,
                                    Task task)
Description copied from interface: Scheduler
Removes a status listener added using addJobStatusListener

Specified by:
removeJobStatusListener in interface Scheduler

fireJobStatusChangeEvent

public void fireJobStatusChangeEvent(StatusEvent e)

fireJobStatusChangeEvent

public void fireJobStatusChangeEvent(Task source,
                                     Status status)

getMaxSimultaneousJobs

public int getMaxSimultaneousJobs()

setMaxSimultaneousJobs

public void setMaxSimultaneousJobs(int i)

getJobQueue

public Queue getJobQueue()

setProperty

public void setProperty(String name,
                        Object value)
Description copied from interface: Scheduler
Sets a scheduler property. The supported property names can be queried using the getPropertyNames method

Specified by:
setProperty in interface Scheduler

throttleValue

protected int throttleValue(Object value)

getProperty

public Object getProperty(String name)

getPropertyNames

public String[] getPropertyNames()
Specified by:
getPropertyNames in interface Scheduler

combineNames

public static String[] combineNames(String[] first,
                                    String[] last)

setConstraints

protected void setConstraints(Task task,
                              Object constraint)

getConstraints

protected Object getConstraints(Task task)

removeConstraints

protected void removeConstraints(Task task)

addTaskTransformer

public void addTaskTransformer(TaskTransformer taskTransformer)
Description copied from interface: Scheduler
Adds a task transformer to this scheduler. A task transformer allows modifying of various task parameters after the task has been fully resolved.

Specified by:
addTaskTransformer in interface Scheduler

getTaskTransformers

public List getTaskTransformers()

applyTaskTransformers

protected void applyTaskTransformers(Task t,
                                     Contact[] contacts,
                                     Service[] services)

runFailureHandlers

protected boolean runFailureHandlers(Task t)

addFailureHandler

public void addFailureHandler(FailureHandler handler)
Description copied from interface: Scheduler
Allows handling task failures at the scheduler level

Specified by:
addFailureHandler in interface Scheduler

getConstraintChecker

public ResourceConstraintChecker getConstraintChecker()

setConstraintChecker

public void setConstraintChecker(ResourceConstraintChecker constraintChecker)

checkConstraints

protected boolean checkConstraints(BoundContact resource,
                                   TaskConstraints tc)

checkConstraints

protected List checkConstraints(List resources,
                                TaskConstraints tc)