|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecthu.mta.sztaki.lpds.cloud.simulator.iaas.vmscheduling.Scheduler
public abstract class Scheduler
The base class for all VM schedulers, provides the foundational logic and simplifies the implementation of VM schedulers by allowing them to mainly focus on their scheduling logic.
Nested Class Summary | |
---|---|
static interface |
Scheduler.QueueingEvent
Implementing this interface allows the implementor to receive events from the scheduler about cases when it believes the infrastructure is not sufficient for its needs. |
Field Summary | |
---|---|
protected VMManager.CapacityChangeEvent<ResourceConstraints> |
freeCapacity
This field represents the action to be done when some resources become free on one of the currently running PMs in the IaaS. |
private AlterableResourceConstraints |
freeResourcesSinceLastSchedule
In this field the simulator maintains those recently freed up resources that could be allowing a new scheduling run |
private ConstantConstraints |
minimumSchedulerRequirement
Here we keep an account of the amount of resources a particular scheduler would need before it would be able to schedule a new VM request |
private ArrayList<PhysicalMachine> |
orderedPMcache
This field contains an automatically updated list of all machines in the parent IaaS. |
protected IaaSService |
parent
The IaaS for which this VM scheduler manages the VM requests. |
private int |
pmCacheLen
current length of the pm cache so we don't need to query its size all the time |
static Comparator<PhysicalMachine> |
pmComparator
A PM comparator that offers inverse ordering of PMs if used during sort |
protected PhysicalMachine.StateChangeListener |
pmstateChanged
This is the action that takes place when one of the PMs at the IaaS changes its state. |
protected UnalterableConstraintsPropagator |
publicTQ
the public version of totalQueued that mirrors its contents but does not allow changes on it |
protected List<QueueingData> |
queue
The queue of the scheduler. |
private StateDependentEventHandler<Scheduler.QueueingEvent,Integer> |
queueListenerManager
the manager of those objects who shown interest in receiving queuing related event notifications |
private AlterableResourceConstraints |
totalQueued
the amount of resources needed for fulfilling all VM requests in the queue |
Constructor Summary | |
---|---|
Scheduler(IaaSService parent)
The main constructor of all schedulers. |
Method Summary | |
---|---|
boolean |
dropVMrequest(VirtualMachine vm)
Cancels a VM request by dropping the corresponding queuing data from the scheduler's queue. |
List<VirtualMachine> |
getQueuedVMs()
Prepares a list of all the VMs that are queued at the particular moment in time |
int |
getQueueLength()
The number of VM requests queued at the moment |
ResourceConstraints |
getTotalQueued()
The complete resource set required to fulfill the entirety of the VM requests in the queue |
private void |
invokeRealScheduler()
This function is actually calling the subclass's scheduler implementation and handles the management of minimum scheduler requirements and resets the free resource aggregate |
protected QueueingData |
manageQueueRemoval()
Removes the head of the queue |
protected void |
manageQueueRemoval(QueueingData qd)
Removes an arbitrary item from the queue (could be a rather slow operation!) |
protected abstract ConstantConstraints |
scheduleQueued()
When a new VM scheduler is created this is the function to be implemented. |
void |
scheduleVMrequest(VirtualMachine[] vms,
ResourceConstraints rc,
Repository vaSource,
HashMap<String,Object> schedulingConstraints)
The main entry point to the schedulers. |
void |
subscribeQueueingEvents(Scheduler.QueueingEvent e)
Allows third parties to get notified if the scheduler is not satisfied with the current infrastructure (e.g. |
void |
unsubscribeQueueingEvents(Scheduler.QueueingEvent e)
Cancels the notifications about queuing events |
private void |
updateTotalQueuedAfterRemoval(QueueingData qd)
The common functionality required to manage the update of the total queued field. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final IaaSService parent
protected List<QueueingData> queue
private AlterableResourceConstraints totalQueued
protected UnalterableConstraintsPropagator publicTQ
private ArrayList<PhysicalMachine> orderedPMcache
private int pmCacheLen
private final StateDependentEventHandler<Scheduler.QueueingEvent,Integer> queueListenerManager
private ConstantConstraints minimumSchedulerRequirement
private AlterableResourceConstraints freeResourcesSinceLastSchedule
public static final Comparator<PhysicalMachine> pmComparator
protected PhysicalMachine.StateChangeListener pmstateChanged
protected VMManager.CapacityChangeEvent<ResourceConstraints> freeCapacity
Constructor Detail |
---|
public Scheduler(IaaSService parent)
parent
- the IaaS service for which this scheduler is expected to act
as the VM request schedulerMethod Detail |
---|
public final void scheduleVMrequest(VirtualMachine[] vms, ResourceConstraints rc, Repository vaSource, HashMap<String,Object> schedulingConstraints) throws VMManager.VMManagementException
vms
- the virtual machines that should be placed on the IaaS's
machine setrc
- the resource requirements for the VMsvaSource
- the repository that stores the virtual appliance for the above
VM set.schedulingConstraints
- custom data to be passed on to subclassed schedulers
VMManager.VMManagementException
- if the request is impossible to schedule on the current
infrastructurepublic final boolean dropVMrequest(VirtualMachine vm)
vm
- the VM which is representing the queued request to be dropped
from the queue
public ResourceConstraints getTotalQueued()
public int getQueueLength()
protected void manageQueueRemoval(QueueingData qd)
qd
- the item to be removedprotected QueueingData manageQueueRemoval()
private void updateTotalQueuedAfterRemoval(QueueingData qd)
qd
- the removed queue member that needs to be deducted from the
total queue fieldpublic final void subscribeQueueingEvents(Scheduler.QueueingEvent e)
e
- the object that will handle the notificationspublic final void unsubscribeQueueingEvents(Scheduler.QueueingEvent e)
e
- the object that no longer needs notificationspublic final List<VirtualMachine> getQueuedVMs()
private void invokeRealScheduler()
protected abstract ConstantConstraints scheduleQueued()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |