Package org.cloudbus.cloudsim.brokers
Class DatacenterBrokerSimple
- java.lang.Object
-
- org.cloudbus.cloudsim.core.CloudSimEntity
-
- org.cloudbus.cloudsim.brokers.DatacenterBrokerAbstract
-
- org.cloudbus.cloudsim.brokers.DatacenterBrokerSimple
-
- All Implemented Interfaces:
Cloneable
,Comparable<SimEntity>
,Runnable
,DatacenterBroker
,Identifiable
,Nameable
,SimEntity
- Direct Known Subclasses:
DatacenterBrokerHeuristic
public class DatacenterBrokerSimple extends DatacenterBrokerAbstract
A simple implementation ofDatacenterBroker
that try to host customer's VMs at the first Datacenter found. If there isn't capacity in that one, it will try the other ones.The selection of VMs for each cloudlet is based on a Round-Robin policy, cyclically selecting the next VM from the broker VM list for each requesting cloudlet.
- Since:
- CloudSim Toolkit 1.0
- Author:
- Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.cloudbus.cloudsim.core.SimEntity
SimEntity.State
-
-
Field Summary
-
Fields inherited from interface org.cloudbus.cloudsim.brokers.DatacenterBroker
DEF_VM_DESTRUCTION_DELAY, LOGGER, NULL
-
-
Constructor Summary
Constructors Constructor Description DatacenterBrokerSimple(CloudSim simulation)
Creates a new DatacenterBroker.DatacenterBrokerSimple(CloudSim simulation, String name)
Creates a DatacenterBroker giving a specific name.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vm
defaultVmMapper(Cloudlet cloudlet)
Defines the default policy used to select a Vm to host a Cloudlet that is waiting to be created.protected Datacenter
selectDatacenterForWaitingVms()
Defines the policy to select a Datacenter to Host a VM.protected Datacenter
selectFallbackDatacenterForWaitingVms()
Defines the policy to select a fallback Datacenter to Host a VM when a previous selected Datacenter failed to create the requested VMs.-
Methods inherited from class org.cloudbus.cloudsim.brokers.DatacenterBrokerAbstract
addOneTimeOnCreationOfWaitingVmsFinishListener, addOneTimeOnVmsCreatedListener, addOnVmsCreatedListener, bindCloudletToVm, getCloudletCreatedList, getCloudletFinishedList, getCloudletSubmittedList, getCloudletWaitingList, getDatacenter, getDatacenterList, getDatacenterRequestedList, getLastSelectedVm, getVmCreatedList, getVmCreationAcks, getVmCreationRequests, getVmDestructionDelayFunction, getVmExecList, getVmFromCreatedList, getVmWaitingList, getWaitingVm, isThereWaitingCloudlets, processEvent, requestDatacentersToCreateWaitingCloudlets, requestDatacenterToCreateWaitingVms, requestDatacenterToCreateWaitingVms, requestDatacenterToCreateWaitingVms, setCloudletComparator, setDatacenterList, setDatacenterSupplier, setFallbackDatacenterSupplier, setVmComparator, setVmDestructionDelayFunction, setVmMapper, shutdownEntity, startEntity, submitCloudlet, submitCloudletList, submitCloudletList, submitCloudletList, submitCloudletList, submitVm, submitVmList, submitVmList, toString
-
Methods inherited from class org.cloudbus.cloudsim.core.CloudSimEntity
cancelEvent, clone, compareTo, equals, getId, getName, getNextEvent, getNextEvent, getSimulation, getState, hashCode, isAlive, isFinished, isStarted, numEventsWaiting, numEventsWaiting, pause, run, schedule, schedule, schedule, schedule, scheduleFirst, scheduleFirst, scheduleFirstNow, scheduleFirstNow, scheduleNow, scheduleNow, selectEvent, send, send, sendNow, sendNow, setEventBuffer, setId, setName, setSimulation, setStarted, setState, start, waitForEvent
-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Comparable
compareTo
-
Methods inherited from interface org.cloudbus.cloudsim.core.Identifiable
getId
-
Methods inherited from interface org.cloudbus.cloudsim.core.SimEntity
getSimulation, getState, isAlive, isFinished, isStarted, run, schedule, schedule, schedule, schedule, setName, setSimulation, setState, start
-
-
-
-
Constructor Detail
-
DatacenterBrokerSimple
public DatacenterBrokerSimple(CloudSim simulation)
Creates a new DatacenterBroker.- Parameters:
simulation
- name to be associated with this entity
-
-
Method Detail
-
selectDatacenterForWaitingVms
protected Datacenter selectDatacenterForWaitingVms()
Defines the policy to select a Datacenter to Host a VM. It always selects the first Datacenter from the Datacenter list.- Returns:
- the Datacenter selected to request the creating
of waiting VMs or
Datacenter.NULL
if no suitable Datacenter was found
-
selectFallbackDatacenterForWaitingVms
protected Datacenter selectFallbackDatacenterForWaitingVms()
Defines the policy to select a fallback Datacenter to Host a VM when a previous selected Datacenter failed to create the requested VMs.It gets the first Datacenter that has not been tried yet.
- Returns:
- the Datacenter selected to try creating
the remaining VMs or
Datacenter.NULL
if no suitable Datacenter was found
-
defaultVmMapper
public Vm defaultVmMapper(Cloudlet cloudlet)
Description copied from interface:DatacenterBroker
Defines the default policy used to select a Vm to host a Cloudlet that is waiting to be created.
It applies a Round-Robin policy to cyclically select the next Vm from the list of waiting VMs.- Parameters:
cloudlet
- the cloudlet that needs a VM to be placed into- Returns:
- the selected Vm for the cloudlet or
Vm.NULL
if no suitable VM was found
-
-