Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Lightweight Bartering Grid
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## lbg.peer.core.xms
Class RunningTaskManager

    java.lang.Object
      lbg.peer.core.xms.RunningTaskManager

Direct Known Subclasses:
  RunningConsumptionTaskManager, RunningLocalTaskManager, RunningSupplyingTaskManager

    public abstract class RunningTaskManager

extends java.lang.Object

Author:
  Cyril Briquet

Method Summary
`void` | `addRunningTask(Task t, long timeout, ExternalPeerHandle peer_handle, java.lang.String supplier_id, boolean do_cancel)` Adds target Task to this running Tasks Manager.
`boolean` | `areSomeTasksRunning()`
`boolean` | `areSomeTasksTimedOut()`
`int` | `countRunningTasks()`
`Task` | `getMostRecentlyRunningAndUngracedTask()` Returns the most recently running Task that has not been graced (useful for PSufferage Resource selection to preempt a running Supplying Task).
`long` | `getStartTime(Task t)` Returns the start time of target Task's execution.
`java.lang.String` | `identifySupplier(Task t)` Identifies which Peer is running the target Task.
`boolean` | `isTaskGraced(Task t)` Identifies if target Task has been graced
`Task[]` | `listRunningTasks()` Lists running Tasks, in decreasing order of execution time (longest-running first).
`abstract boolean` | `processTimedOutTasks()` Processes timed-out Tasks.
`long` | `removeRunningTask(Task t)` Removes target Task from this running Tasks Manager.
`java.lang.String` | `toString()`
`boolean` | `updateTimeOutActionTag(Task t, boolean do_cancel)` Updates the time-out action tag associated with the target Task.
`boolean` | `updateTimeOutActionTagAndValue(Task t, boolean do_cancel, long time_out)` Updates the time-out and action tag associated with the target Task.
`void` | `updateTimeOutValue(Task t, long time_out)` Updates the time-out associated with the target Task.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Method Detail

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`

### addRunningTask

    public void addRunningTask(Task t,
                               long timeout,
                               ExternalPeerHandle peer_handle,
                               java.lang.String supplier_id,
                               boolean do_cancel)
                        throws GridException

  Adds target Task to this running Tasks Manager.

  Parameters:
    `t` - target Task
    `timeout` - timeout value
    `peer_handle` - handle of Peer to contact
    `supplier_id` - supplier id
    `do_cancel` - true to cancel the Task upon time-out, false to only preempt the Task upon time-out
  Throws:
    `GridException` - if a parameter is illegal

### removeRunningTask

    public long removeRunningTask(Task t)
                           throws GridException

  Removes target Task from this running Tasks Manager.

  Parameters:
    `t` - target Task
  Returns:
    Task start time
  Throws:
    `GridException` - if a parameter is illegal

### identifySupplier

    public java.lang.String identifySupplier(Task t)
                                      throws GridException

  Identifies which Peer is running the target Task.

  Parameters:
    `t` - target Task
  Returns:
    Peer running the Task, or null no such Task is running
  Throws:
    `GridException` - if a parameter is illegal

### getStartTime

    public long getStartTime(Task t)
                      throws GridException

  Returns the start time of target Task's execution.

  Parameters:
    `t` - target Task
  Returns:
    start time
  Throws:
    `GridException` - if a parameter is illegal

### updateTimeOutActionTag

    public boolean updateTimeOutActionTag(Task t,
                                          boolean do_cancel)
                                   throws GridException

  Updates the time-out action tag associated with the target Task.

  Parameters:
    `t` - target Task
    `do_cancel` - time-out action tag
  Returns:
    true if the action tag has been updated, or false if it were not updated (i.e. the action tag has already been updated)
  Throws:
    `GridException` - if a parameter is illegal

### updateTimeOutValue

    public void updateTimeOutValue(Task t,
                                   long time_out)
                            throws GridException

  Updates the time-out associated with the target Task.

  Parameters:
    `t` - target Task
    `time_out` - time-out
  Throws:
    `GridException` - if a parameter is illegal

### updateTimeOutActionTagAndValue

    public boolean updateTimeOutActionTagAndValue(Task t,
                                                  boolean do_cancel,
                                                  long time_out)
                                           throws GridException

  Updates the time-out and action tag associated with the target Task.

  Parameters:
    `t` - target Task
    `do_cancel` - time-out action tag
    `time_out` - time-out
  Returns:
    true if the time-out and action tag have been updated, or false if they were not updated (i.e. the action tag has already been updated)
  Throws:
    `GridException` - if a parameter is illegal

### isTaskGraced

    public boolean isTaskGraced(Task t)
                         throws GridException

  Identifies if target Task has been graced

  Parameters:
    `t` - target Task
  Returns:
    true if target Task has been graced
  Throws:
    `GridException` - if a parameter is illegal

### areSomeTasksTimedOut

    public boolean areSomeTasksTimedOut()
                                 throws GridException

  Throws:
    `GridException`

### areSomeTasksRunning

    public boolean areSomeTasksRunning()
                                throws GridException

  Throws:
    `GridException`

### countRunningTasks

    public int countRunningTasks()
                          throws GridException

  Throws:
    `GridException`

### listRunningTasks

    public Task[] listRunningTasks()

  Lists running Tasks, in decreasing order of execution time (longest-running first).

  Returns:
    running Tasks, in decreasing order of execution time

### getMostRecentlyRunningAndUngracedTask

    public Task getMostRecentlyRunningAndUngracedTask()
                                               throws GridException

  Returns the most recently running Task that has not been graced (useful for PSufferage Resource selection to preempt a running Supplying Task).

  Returns:
    most recently running Task that has not been graced, or null if there is no running Task ungraced
  Throws:
    `GridException`

### processTimedOutTasks

    public abstract boolean processTimedOutTasks()
                                          throws GridException

  Processes timed-out Tasks.

  Returns:
    true if at least one Task has been preempted or cancelled
  Throws:
    `GridException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Lightweight Bartering Grid
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

> Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.