net.eduvax.grant.core
Class TaskletManager

java.lang.Object
  extended by net.eduvax.grant.core.TaskletManager

public class TaskletManager
extends java.lang.Object


Nested Class Summary
private  class TaskletManager.TaskletThread
          Tasklet Thread wrapper.
 
Field Summary
private static TaskletJarCache jarCache
          tasklet jar files handler.
private static SLogger logger
          logger
private  int maxRunningCount
          max running task count.
private  LocalNode node
          attached node.
private  int runningCount
          running task count.
private  java.util.Hashtable runningTasklets
          running tasklets list.
static int SCHED_ERR_ACCESS
           
static int SCHED_ERR_CREATE
           
static int SCHED_OK
           
static int SCHED_OVERFLOW
           
 
Constructor Summary
protected TaskletManager()
           
(package private) TaskletManager(LocalNode n)
          create new tasklet manager attached to a node.
 
Method Summary
 int getRunningCount()
           
protected static Tasklet prepareTasklet(ExecRequest er)
          Create TaskletInstance from task URL and command args.
private  void report(ExecReport report)
          Report task completion to attached node
 int schedule(ExecRequest er)
          Schedule a job.
 void stopAll()
          stop all running tasklets.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SCHED_OK

public static final int SCHED_OK
See Also:
Constant Field Values

SCHED_OVERFLOW

public static final int SCHED_OVERFLOW
See Also:
Constant Field Values

SCHED_ERR_CREATE

public static final int SCHED_ERR_CREATE
See Also:
Constant Field Values

SCHED_ERR_ACCESS

public static final int SCHED_ERR_ACCESS
See Also:
Constant Field Values

runningCount

private int runningCount
running task count.


maxRunningCount

private int maxRunningCount
max running task count.


runningTasklets

private java.util.Hashtable runningTasklets
running tasklets list.


node

private LocalNode node
attached node.


jarCache

private static TaskletJarCache jarCache
tasklet jar files handler.


logger

private static SLogger logger
logger

Constructor Detail

TaskletManager

protected TaskletManager()

TaskletManager

TaskletManager(LocalNode n)
create new tasklet manager attached to a node.

Parameters:
n - node to attache to this tasklet manager.
Method Detail

getRunningCount

public int getRunningCount()

schedule

public int schedule(ExecRequest er)
Schedule a job.

Parameters:
er - job request description.
Returns:
schedule completion code :
  • SCHED_OK : tasklet thread created and started.
  • SCHED_OVERFLOW : max runninf thread count reached.
  • SCHED_ERR_CREATE : can't create and start new thread.
  • SCHED_ERR_ACCESS : can't get tasklet code.

stopAll

public void stopAll()
stop all running tasklets.


prepareTasklet

protected static Tasklet prepareTasklet(ExecRequest er)
Create TaskletInstance from task URL and command args.

Parameters:
taskURL - tasklet download URL
params - command line arguments
Returns:
a tasklet, ready to run, null on error.

report

private void report(ExecReport report)
Report task completion to attached node

Parameters:
report - execution report