org.objectweb.proactive.scheduler.policy
Class AbstractPolicy

java.lang.Object
  extended by org.objectweb.proactive.scheduler.policy.AbstractPolicy
All Implemented Interfaces:
java.io.Serializable, Active, RunActive, JobConstants, SchedulerConstants
Direct Known Subclasses:
FIFOPolicy, MixedPolicy, SpacePolicy, TimePolicy

public abstract class AbstractPolicy
extends java.lang.Object
implements java.io.Serializable, RunActive, JobConstants, SchedulerConstants

This is an abstract class that contains all the essential tools for the job managers to run. Mainly, the insertion and deployement of jobs, and an abstract comparer that should be redefined in the specific policies.

Author:
cjarjouh
See Also:
Serialized Form

Field Summary
protected  java.util.HashMap deployedTasks
           
protected  Queue queue
           
protected  RessourceManager ressourceManager
           
 
Fields inherited from interface org.objectweb.proactive.scheduler.JobConstants
XML_DESC
 
Fields inherited from interface org.objectweb.proactive.scheduler.SchedulerConstants
JOB_ID, JVM_PARAMETERS, POLICY_NAME, SCHEDULER_NODE_NAME, SCHEDULER_URL, XML_PATH
 
Constructor Summary
AbstractPolicy()
           
AbstractPolicy(RessourceManager ressourceManager)
          This is the main constructor for the creation of the job manager object.
 
Method Summary
 void checkRunningTasks()
          Check the list of the running jobs to find out if there is one that's finished so that we can free the allocated ressources.
 BooleanWrapper del(java.lang.String jobId)
          Deletes the job from the queue and stops it if it has already been launched.
 void end()
          Does some cleaning before ending the job manager.
 void execute()
          This method is used to execute a job if the required ressources are available.
 java.util.HashMap getDeployedTasks()
          returns the list of the deployed jobs.
 Queue getQueue()
          Returns the queue that stores the waiting jobs.
abstract  boolean isToBeServed(GenericJob job1, GenericJob job2)
          This is an abstract comparer method to be redefined by the specifique policy ...
 java.lang.String nextTask()
          returns the job that should run next (according to the implemented policy).
 void runActivity(Body body)
          This method has been redefined to reimplement the way this active object works and serves its methods.
 java.util.Vector stat(java.lang.String jobId)
          Gives description of all the jobs that are curently running in forms of a Vector if no specific id is specified, else, it gives the description of the specified job if it exists.
 BooleanWrapper sub(GenericJob job)
          Insert job's descriptions in the queue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ressourceManager

protected RessourceManager ressourceManager

queue

protected Queue queue

deployedTasks

protected java.util.HashMap deployedTasks
Constructor Detail

AbstractPolicy

public AbstractPolicy()

AbstractPolicy

public AbstractPolicy(RessourceManager ressourceManager)
This is the main constructor for the creation of the job manager object.

Parameters:
ressourceManager - the ressourceManager object responsible for the management and the acquisition of the ressources.
Method Detail

runActivity

public void runActivity(Body body)
This method has been redefined to reimplement the way this active object works and serves its methods.

Specified by:
runActivity in interface RunActive
Parameters:
body - the body of the active object being started

checkRunningTasks

public void checkRunningTasks()
Check the list of the running jobs to find out if there is one that's finished so that we can free the allocated ressources.


sub

public BooleanWrapper sub(GenericJob job)
Insert job's descriptions in the queue.

Parameters:
job: - the descriptions of the job
Returns:
false if the queue is full and true otherwise.

del

public BooleanWrapper del(java.lang.String jobId)
Deletes the job from the queue and stops it if it has already been launched.

Parameters:
id: - the id of the job
Returns:
true if the operation completed succesfully, false orherwise.

stat

public java.util.Vector stat(java.lang.String jobId)
Gives description of all the jobs that are curently running in forms of a Vector if no specific id is specified, else, it gives the description of the specified job if it exists.

Returns:
an ArrayList containing the description of all the running jobs.

isToBeServed

public abstract boolean isToBeServed(GenericJob job1,
                                     GenericJob job2)
This is an abstract comparer method to be redefined by the specifique policy ... Returns true if job1 is to be served before job2 according to the policy.

Parameters:
job1 -
job2 -
Returns:
true if job1 is to be served before job2.

nextTask

public java.lang.String nextTask()
returns the job that should run next (according to the implemented policy).

Returns:
the job that should run next (according to the implemented policy).

getDeployedTasks

public java.util.HashMap getDeployedTasks()
returns the list of the deployed jobs.

Returns:
the list of the deployed jobs.

execute

public void execute()
This method is used to execute a job if the required ressources are available.


end

public void end()
Does some cleaning before ending the job manager.


getQueue

public Queue getQueue()
Returns the queue that stores the waiting jobs.

Returns:
the queue that stores the waiting jobs.


Copyright 2001-2007 INRIA All Rights Reserved.