org.globus.cog.karajan.scheduler
Class LateBindingScheduler

java.lang.Object
  extended byjava.lang.Thread
      extended byorg.globus.cog.karajan.scheduler.AbstractScheduler
          extended byorg.globus.cog.karajan.scheduler.LateBindingScheduler
All Implemented Interfaces:
Runnable, Scheduler, StatusListener
Direct Known Subclasses:
DefaultScheduler, WeightedHostScoreScheduler

public abstract class LateBindingScheduler
extends AbstractScheduler
implements StatusListener


Field Summary
protected  Hashtable executionHandlers
           
static String[] propertyNames
           
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
LateBindingScheduler()
           
 
Method Summary
 Contact allocateContact()
          Attempt to allocate a host.
 void cancelTask(Task task)
          Prematurely terminates a task that is either enqueued or running
 boolean checkFreeMemory()
           
protected  void checkGlobalLoadConditions()
           
protected  boolean checkLoad(BoundContact contact)
           
protected  int decRunning()
           
 void enqueue(Task task, Object constraints)
          Adds a task to the queue.
 TaskHandler findTaskHandler(Task task, Service[] services)
           
protected  Contact[] getContacts(Task t)
           
protected  TaskHandler getHandler(Task t)
           
 int getHandlerType(int taskType)
           
protected  int getJobsPerCPU()
           
protected abstract  BoundContact getNextContact()
           
 String[] getPropertyNames()
           
 int getRunning()
           
 HashMap getVirtualContacts()
           
protected  int incRunning()
           
 boolean isDone()
           
 void releaseContact(BoundContact contact)
          Can be used to tell the scheduler that a previously allocated contact (using allocateContact()) is not used any more.
protected  void removeHandler(Task t)
           
 BoundContact resolveContact(Contact contact)
           
 Service resolveService(BoundContact contact, int taskType)
           
 BoundContact resolveVirtualContact(Contact contact)
           
 void run()
           
protected  void setHandler(Task t, TaskHandler th)
           
 void setProperty(String name, Object value)
          Sets a scheduler property.
 void setVirtualContacts(HashMap virtualContacts)
           
 void statusChanged(StatusEvent e)
           
 void submitBoundToServices(Task t, Contact[] contacts, Service[] services)
           
 void terminate()
           
 
Methods inherited from class org.globus.cog.karajan.scheduler.AbstractScheduler
addJobStatusListener, addTaskHandler, combineNames, fireJobStatusChangeEvent, fireJobStatusChangeEvent, getConstraints, getJobQueue, getMaxSimultaneousJobs, getProperty, getResources, getTaskHadlerWrapper, getTaskHandlers, getTaskHandlerWrapper, getTaskHandlerWrappers, removeJobStatusListener, setConstraints, setMaxSimultaneousJobs, setResources, setTaskHandlers
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, 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

executionHandlers

protected Hashtable executionHandlers

propertyNames

public static String[] propertyNames
Constructor Detail

LateBindingScheduler

public LateBindingScheduler()
Method Detail

allocateContact

public Contact allocateContact()
                        throws NoFreeResourceException
Description copied from interface: Scheduler
Attempt to allocate a host. The returned object should be used later by the requestor as a constraint while enqueuing a task.

Specified by:
allocateContact in interface Scheduler
Throws:
NoFreeResourceException

releaseContact

public void releaseContact(BoundContact contact)
Description copied from interface: Scheduler
Can be used to tell the scheduler that a previously allocated contact (using allocateContact()) is not used any more.

Specified by:
releaseContact in interface Scheduler

resolveVirtualContact

public BoundContact resolveVirtualContact(Contact contact)
                                   throws NoFreeResourceException
Throws:
NoFreeResourceException

getVirtualContacts

public HashMap getVirtualContacts()

setVirtualContacts

public void setVirtualContacts(HashMap virtualContacts)

getNextContact

protected abstract BoundContact getNextContact()
                                        throws NoFreeResourceException
Throws:
NoFreeResourceException

enqueue

public void enqueue(Task task,
                    Object constraints)
Description copied from interface: Scheduler
Adds a task to the queue.

Specified by:
enqueue in interface Scheduler
Parameters:
constraints - Can be used to specify constraints under which the task should be scheduler. While the semantics of the constraints are left to the implementation, such an implementation should be able to handle at least constraints of the type Contact.
See Also:
org.globus.karajan.util.Contact

isDone

public boolean isDone()

getRunning

public int getRunning()

checkGlobalLoadConditions

protected void checkGlobalLoadConditions()
                                  throws NoFreeResourceException
Throws:
NoFreeResourceException

checkFreeMemory

public boolean checkFreeMemory()

incRunning

protected int incRunning()

decRunning

protected int decRunning()

run

public void run()
Specified by:
run in interface Runnable

terminate

public void terminate()

resolveContact

public BoundContact resolveContact(Contact contact)
                            throws NoFreeResourceException
Throws:
NoFreeResourceException

resolveService

public Service resolveService(BoundContact contact,
                              int taskType)
                       throws NoFreeResourceException
Throws:
NoFreeResourceException

getHandlerType

public int getHandlerType(int taskType)

findTaskHandler

public TaskHandler findTaskHandler(Task task,
                                   Service[] services)
                            throws TaskSubmissionException,
                                   InvalidProviderException,
                                   ProviderMethodException
Throws:
TaskSubmissionException
InvalidProviderException
ProviderMethodException

submitBoundToServices

public void submitBoundToServices(Task t,
                                  Contact[] contacts,
                                  Service[] services)
                           throws TaskSubmissionException
Throws:
TaskSubmissionException

getJobsPerCPU

protected int getJobsPerCPU()

getHandler

protected TaskHandler getHandler(Task t)

setHandler

protected void setHandler(Task t,
                          TaskHandler th)

removeHandler

protected void removeHandler(Task t)

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
Overrides:
setProperty in class AbstractScheduler

statusChanged

public void statusChanged(StatusEvent e)
Specified by:
statusChanged in interface StatusListener

cancelTask

public void cancelTask(Task task)
Description copied from interface: Scheduler
Prematurely terminates a task that is either enqueued or running

Specified by:
cancelTask in interface Scheduler

checkLoad

protected boolean checkLoad(BoundContact contact)
                     throws NoFreeResourceException
Throws:
NoFreeResourceException

getPropertyNames

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

getContacts

protected Contact[] getContacts(Task t)