|
Lightweight Bartering Grid | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectlbg.peer.core.qms.QueueManager
public class QueueManager
Queueing Management System, or Request Manager.
Local Jobs and Supplying Jobs are maintained by order of submission time in their own queue respectively.
Each Local Job is currently composed of 1 Bag of Tasks.
Each Supplying Job is currently composed of 1 Bag of 1 Task.
Field Summary | |
---|---|
static int |
ALLOWED_PREEMPTIONS_BEFORE_CANCELLATION
Number of allowed preemptions (expectedly a high value, e.g. |
Constructor Summary | |
---|---|
QueueManager(Peer managed_peer,
Scheduler scheduler,
boolean enable_ttg)
|
Method Summary | |
---|---|
int |
countWaitingLocalTasks()
|
int |
countWaitingSupplyingTasks()
|
void |
dequeueAllWaitingSupplyingTasks(boolean notify_consumers)
Dequeues all waiting Supplying Tasks. |
void |
dequeueCancelledLocalTask(Task t,
long xstart_time,
long runtime,
java.lang.String supplier_id)
Dequeues a Local Task after its execution has been cancelled. |
void |
dequeueCancelledSupplyingTask(Task t,
long xstart_time)
Dequeues a Supplying Task after its execution has been cancelled. |
RequestStatus |
dequeueCompletedConsumptionTask(Task t,
long xstart_time,
long runtime)
Dequeues a Consumption Task after its execution has been completed |
RequestStatus |
dequeueCompletedLocalTask(Task t,
long xstart_time,
long runtime)
Dequeues a Local Task after its execution has been completed |
RequestStatus |
dequeueCompletedSupplyingTask(Task t,
long xstart_time,
long runtime)
Dequeues a Supplying Task after its execution has been completed |
void |
dequeueLocalJob(int job_id)
Dequeues a Local Job. |
void |
dequeueMostRecentWaitingSupplyingTasks(boolean notify_consumers,
int k)
Dequeues the k most recently queued waiting Supplying Tasks. |
void |
dequeueOldestWaitingSupplyingTaskOfConsumer(boolean notify_consumer,
java.lang.String consumer_id)
Dequeues the oldest waiting Supplying Task of target consumer. |
void |
dequeueWaitingLocalTask(Task t)
Dequeues a waiting Local Task. |
void |
dequeueWaitingSupplyingTask(boolean notify_consumer,
Task t)
Dequeues target waiting Supplying Task. |
void |
dequeueWorstRankedWaitingSupplyingTasks(boolean notify_consumers,
int k)
Dequeues the k worst NoF-ranked queued waiting Supplying Tasks. |
PeerProfile[] |
getAllConsumers()
Profiles of all consumer Peers with queued Supplying Tasks. |
long |
getCompletedLocalJobsCount()
|
double |
getMeanJobCompletionTime()
|
double |
getMeanJobCompletionTimeOfFirstKJobs(int k)
|
double |
getMeanJobCompletionTimeOfNm5FirstKJobs()
|
PeerProfile[] |
getRunningConsumers()
Profiles of all consumer Peers with running Supplying Tasks. |
double |
getStdDevJobCompletionTime()
|
PeerProfile[] |
getWaitingConsumers()
Profiles of all consumer Peers with waiting Supplying Tasks. |
boolean |
hasWaitingLocalTasks()
|
boolean |
hasWaitingSupplyingTasks()
|
boolean |
isSupplyingTaskRunning(Task t)
|
void |
preemptWaitingSupplyingTasks()
|
JobPreQueue |
prequeue()
|
int |
queryLocalJobStatus(int job_id)
Returns the number of completed Tasks of target Local Job. |
void |
queueLocalJob(Job job)
Queues a Local Job. |
void |
queueSupplyingJob(Job job,
java.lang.String consumer_id)
Queues a Supplying Job. |
void |
requeuePreemptedConsumptionTask(Task t,
long xstart_time,
long runtime,
java.lang.String supplier_id)
Requeues a Consumption Task after its execution has been cancelled. |
void |
requeuePreemptedLocalTask(Task t,
long xstart_time,
long runtime,
java.lang.String supplier_id)
Requeues a Local Task after its execution has been cancelled. |
void |
requeuePreemptedSupplyingTask(Task t,
long xstart_time)
Requeues a Supplying Task after its execution has been cancelled. |
void |
requeueUnqueuedConsumptionTask(Task t)
Requeues a Consumption Task that has been unqueued, but not executed, i.e. |
void |
requeueUnqueuedLocalTask(Task t)
Requeues a Local Task that has been unqueued, but not executed, i.e. |
void |
requeueUnqueuedSupplyingTask(Task t)
Requeues a Supplying Task that has been unqueued, but not executed, i.e. |
RequestContainer |
scheduleBestRankedSupplyingTask()
Selects for Local execution the best Favors-ranked, queued, yet unscheduled Supplying Task |
RequestContainer |
scheduleFirstConsumptionTask(boolean head_job_only)
Selects for Consumption execution the first queued, yet unscheduled Local Task. |
RequestContainer |
scheduleFirstLocalTask(boolean head_job_only)
Selects for Local execution the first queued, yet unscheduled Local Task. |
RequestContainer |
scheduleFirstSupplyingTask()
Selects for Local execution the first queued, yet unscheduled Supplying Task |
RequestContainer |
scheduleNextConsumptionTask(LocalQueueCursor lqc)
Selects for Consumption execution the next queued, yet unscheduled Local Task |
boolean |
shouldPreemptWaitingSupplyingTasks()
Indicates whether waiting Supplying Tasks should be dequeued, i.e. |
java.lang.String |
toString()
|
void |
updateStatistics()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int ALLOWED_PREEMPTIONS_BEFORE_CANCELLATION
This Task control mechanism prevents Tasks-that-can-never-complete (i.e.~because they are bugged) to become zombies.
Constructor Detail |
---|
public QueueManager(Peer managed_peer, Scheduler scheduler, boolean enable_ttg) throws GridException
GridException
Method Detail |
---|
public java.lang.String toString()
toString
in class java.lang.Object
public JobPreQueue prequeue()
public boolean hasWaitingLocalTasks()
public boolean hasWaitingSupplyingTasks()
public int countWaitingLocalTasks()
public int countWaitingSupplyingTasks()
public double getMeanJobCompletionTime()
public double getMeanJobCompletionTimeOfFirstKJobs(int k) throws GridException
GridException
public double getMeanJobCompletionTimeOfNm5FirstKJobs() throws GridException
GridException
public double getStdDevJobCompletionTime()
public long getCompletedLocalJobsCount()
public void queueLocalJob(Job job) throws GridException
job
- Local Job to queue
GridException
- if a parameter is illegalpublic void queueSupplyingJob(Job job, java.lang.String consumer_id) throws GridException
job
- Supplying Job to queue
GridException
- if a parameter is illegalpublic int queryLocalJobStatus(int job_id) throws GridException
GridException
- if an unexpected error occurspublic boolean isSupplyingTaskRunning(Task t) throws GridException
GridException
public RequestContainer scheduleFirstLocalTask(boolean head_job_only) throws GridException
head_job_only
- if true, selects Tasks from head Local Job only
GridException
- if queue is corruptedpublic RequestContainer scheduleFirstConsumptionTask(boolean head_job_only) throws GridException
head_job_only
- if true, selects Tasks from head Local Job only
GridException
- if queue is corruptedpublic RequestContainer scheduleNextConsumptionTask(LocalQueueCursor lqc) throws GridException
GridException
- if a parameter is illegalpublic RequestContainer scheduleFirstSupplyingTask() throws GridException
GridException
- if queue is corruptedpublic RequestContainer scheduleBestRankedSupplyingTask() throws GridException
GridException
- if queue is corruptedpublic RequestStatus dequeueCompletedLocalTask(Task t, long xstart_time, long runtime) throws GridException
t
- target Taskxstart_time
- Task execution start timeruntime
- Task run time
GridException
- if a parameter is illegalpublic RequestStatus dequeueCompletedConsumptionTask(Task t, long xstart_time, long runtime) throws GridException
t
- target Taskxstart_time
- Task execution start timeruntime
- Task run time
GridException
- if a parameter is illegalpublic RequestStatus dequeueCompletedSupplyingTask(Task t, long xstart_time, long runtime) throws GridException
t
- target Taskxstart_time
- Task execution start timeruntime
- Task run time
GridException
- if Task or queue is corruptedpublic void requeueUnqueuedLocalTask(Task t) throws GridException
Unqueued Tasks are in a bizarre state, as they have been removed from the waiting queue, but haven't yet been added to the running queue. It is therefore very important to put them back into the waiting queue.
t
- target Task
GridException
- if Task or queue is corruptedpublic void requeueUnqueuedConsumptionTask(Task t) throws GridException
Unqueued Tasks are in a bizarre state, as they have been removed from the waiting queue, but haven't yet been added to the running queue. It is therefore very important to put them back into the waiting queue.
t
- target Task
GridException
- if Task or queue is corruptedpublic void requeuePreemptedLocalTask(Task t, long xstart_time, long runtime, java.lang.String supplier_id) throws GridException
t
- target Local Taskxstart_time
- Task execution start timeruntime
- Task run timesupplier_id
- Supplier Peer id,
in this case equals to the Task owner Peer id
GridException
- if a parameter is illegalpublic void requeuePreemptedConsumptionTask(Task t, long xstart_time, long runtime, java.lang.String supplier_id) throws GridException
t
- target Consumption Taskxstart_time
- Task execution start timeruntime
- Task run timesupplier_id
- Supplier Peer id
GridException
- if a parameter is illegalpublic void requeueUnqueuedSupplyingTask(Task t) throws GridException
Unqueued Tasks are in a bizarre state, as they have been removed from the waiting queue, but haven't yet been added to the running queue. It is therefore very important to put them back into the waiting queue.
t
- target Task
GridException
- if Task or queue is corruptedpublic void requeuePreemptedSupplyingTask(Task t, long xstart_time) throws GridException
t
- target Taskxstart_time
- Task execution start time
GridException
- if Task or queue is corruptedpublic void dequeueLocalJob(int job_id) throws GridException
Note: as User-generated Job cancellation is not currently supported, this method is currently not implemented and will throw a GridException.
job_id
- target job_id
GridException
- if Task or queue is corruptedpublic void dequeueCancelledLocalTask(Task t, long xstart_time, long runtime, java.lang.String supplier_id) throws GridException
t
- target Local Taskxstart_time
- Task execution start timeruntime
- Task run timesupplier_id
- Supplier Peer id,
in this case equals to the Task owner Peer id
GridException
- if Task or queue is corruptedpublic void dequeueWaitingLocalTask(Task t) throws GridException
t
- target Task
GridException
- if Task or queue is corruptedpublic void dequeueCancelledSupplyingTask(Task t, long xstart_time) throws GridException
t
- target Taskxstart_time
- Task execution start time
GridException
- if Task or queue is corruptedpublic void dequeueWaitingSupplyingTask(boolean notify_consumer, Task t) throws GridException
notify_consumer
- communicates cancellation to consumert
- target Task
GridException
- if Task or queue is corruptedpublic void dequeueOldestWaitingSupplyingTaskOfConsumer(boolean notify_consumer, java.lang.String consumer_id) throws GridException
notify_consumer
- communicates cancellation to consumerconsumer_id
- target consumer
GridException
- if Task or queue is corruptedpublic void dequeueAllWaitingSupplyingTasks(boolean notify_consumers) throws GridException
notify_consumers
- communicates cancellations to consumers
GridException
- if queue is corruptedpublic void dequeueMostRecentWaitingSupplyingTasks(boolean notify_consumers, int k) throws GridException
notify_consumers
- communicates cancellations to consumersk
- number of Supplying Tasks to dequeue
GridException
- if queue is corruptedpublic void dequeueWorstRankedWaitingSupplyingTasks(boolean notify_consumers, int k) throws GridException
notify_consumers
- communicates cancellations to consumersk
- number of Supplying Tasks to dequeue
GridException
- if queue is corruptedpublic boolean shouldPreemptWaitingSupplyingTasks()
public void preemptWaitingSupplyingTasks() throws GridException
GridException
public PeerProfile[] getRunningConsumers()
public PeerProfile[] getWaitingConsumers()
public PeerProfile[] getAllConsumers()
public void updateStatistics()
|
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.