Lightweight Bartering Grid

lbg.peer.strategy.scheduling.consumption
Class CommonConsumptionScheduling

java.lang.Object
  extended by lbg.peer.strategy.scheduling.consumption.CommonConsumptionScheduling
All Implemented Interfaces:
ConsumptionSchedulingPolicy
Direct Known Subclasses:
AdaptiveMC4ConsumptionScheduling, AdaptiveTCoRConsumptionScheduling, ConservativeTimeStrideConsumptionScheduling, DataConsumptionScheduling, FavorsConsumptionScheduling, GrantsConsumptionScheduling, MC4ConsumptionScheduling, MCoSConsumptionScheduling, MTBCConsumptionScheduling, MTTCConsumptionScheduling, PerformanceConsumptionScheduling, RandomConsumptionScheduling, ReliableMLConsumptionScheduling, TCaRConsumptionScheduling, TCoRConsumptionScheduling

public abstract class CommonConsumptionScheduling
extends java.lang.Object
implements ConsumptionSchedulingPolicy

Reliability-ranked use of Consumption Grants.

Author:
Cyril Briquet

Constructor Summary
CommonConsumptionScheduling(Peer managed_peer, Scheduler scheduler)
           
 
Method Summary
protected static boolean assertConsumptionGrantsAvailability(ConsumptionGrantsContainer c_g, int peer_idx)
           
protected abstract  LocalQueueCursor getLocalQueueCursor()
          Local Queue Cursor accessor.
protected abstract  Ranking rankSuppliers(ConsumptionGrantsContainer c_g, RequestContainer rc)
          Rank Suppliers.
 int scheduleConsumptionTasks()
          ConsumptionSchedulingPolicy implementation.
protected  RequestContainer scheduleFirstConsumptionTask()
          Schedules first queued Local Task as a Consumption Task.
protected  RequestContainer scheduleNextConsumptionTask(LocalQueueCursor lqc)
          Schedules next queued Local Task as a Consumption Task.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CommonConsumptionScheduling

public CommonConsumptionScheduling(Peer managed_peer,
                                   Scheduler scheduler)
                            throws GridException
Throws:
GridException
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

scheduleConsumptionTasks

public int scheduleConsumptionTasks()
                             throws GridException
ConsumptionSchedulingPolicy implementation.

Note: this implementation requires that getLocalQueueCursor() returns a non-null reference to an existing Local Queue Cursor.

Specified by:
scheduleConsumptionTasks in interface ConsumptionSchedulingPolicy
Returns:
number of successfully scheduled Consumption Tasks
Throws:
GridException - if an error occurs while using Consumption Grants to schedule Consumption Tasks

rankSuppliers

protected abstract Ranking rankSuppliers(ConsumptionGrantsContainer c_g,
                                         RequestContainer rc)
                                  throws GridException
Rank Suppliers.

Parameters:
c_g - collected Consumption Grants container
rc - target Task container
Returns:
Suppliers Ranking
Throws:
GridException - if a problem occured while ranking Suppliers

getLocalQueueCursor

protected abstract LocalQueueCursor getLocalQueueCursor()
Local Queue Cursor accessor.

Returns:
Local Queue Cursor, or null if none has been defined

scheduleFirstConsumptionTask

protected RequestContainer scheduleFirstConsumptionTask()
                                                 throws GridException
Schedules first queued Local Task as a Consumption Task.

Returns:
first Consumption Task, may be null if all waiting Local Tasks are restricted to local execution
Throws:
GridException - if there is no Consumption Task to schedule

scheduleNextConsumptionTask

protected RequestContainer scheduleNextConsumptionTask(LocalQueueCursor lqc)
                                                throws GridException
Schedules next queued Local Task as a Consumption Task. The next Local Task is determined by following information provided by the Local Queue cursor.

Parameters:
lqc - Local Queue Cursor
Returns:
next Consumption Task, may be null if all waiting Local Tasks are restricted to local execution
Throws:
GridException - if a parameter is illegal

assertConsumptionGrantsAvailability

protected static boolean assertConsumptionGrantsAvailability(ConsumptionGrantsContainer c_g,
                                                             int peer_idx)
                                                      throws GridException
Throws:
GridException

Lightweight Bartering Grid

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