DatacenterBrokerAbstract

public abstract class DatacenterBrokerAbstract extends CloudSimEntity implements DatacenterBroker

An abstract class to be used as base for implementing a DatacenterBroker.

Author:Rodrigo N. Calheiros, Anton Beloglazov, Manoel Campos da Silva Filho

Constructors

DatacenterBrokerAbstract

public DatacenterBrokerAbstract(CloudSim simulation)

Creates a DatacenterBroker.

Parameters:
  • simulation – the CloudSim instance that represents the simulation the Entity is related to

DatacenterBrokerAbstract

public DatacenterBrokerAbstract(CloudSim simulation, String name)

Creates a DatacenterBroker giving a specific name.

Parameters:
  • simulation – the CloudSim instance that represents the simulation the Entity is related to
  • name – the DatacenterBroker name

Methods

addOnVmsCreatedListener

public DatacenterBroker addOnVmsCreatedListener(EventListener<DatacenterBrokerEventInfo> listener)

addOneTimeOnCreationOfWaitingVmsFinishListener

public DatacenterBroker addOneTimeOnCreationOfWaitingVmsFinishListener(EventListener<DatacenterBrokerEventInfo> listener, Boolean oneTimeListener)

addOneTimeOnVmsCreatedListener

public DatacenterBroker addOneTimeOnVmsCreatedListener(EventListener<DatacenterBrokerEventInfo> listener)

bindCloudletToVm

public boolean bindCloudletToVm(Cloudlet cloudlet, Vm vm)

getCloudletCreatedList

public List<Cloudlet> getCloudletCreatedList()

getCloudletFinishedList

public <T extends Cloudlet> List<T> getCloudletFinishedList()

getCloudletSubmittedList

public List<Cloudlet> getCloudletSubmittedList()

getCloudletWaitingList

public <T extends Cloudlet> List<T> getCloudletWaitingList()

getDatacenter

protected Datacenter getDatacenter(Vm vm)

Gets the Datacenter where a VM is placed.

Parameters:
  • vm – the VM to get its Datacenter

getDatacenterList

protected List<Datacenter> getDatacenterList()

Gets the list of available datacenters.

Returns:the dc list

getDatacenterRequestedList

protected Set<Datacenter> getDatacenterRequestedList()

Gets the list of datacenters where was requested to place VMs.

getLastSelectedVm

protected Vm getLastSelectedVm()
Returns:latest VM selected to run a cloudlet.

getVmCreatedList

public <T extends Vm> List<T> getVmCreatedList()

getVmCreationAcks

protected int getVmCreationAcks()

Gets the number of acknowledges (ACKs) received from Datacenters in response to requests to create VMs. The number of acks doesn’t mean the number of created VMs, once Datacenters can respond informing that a Vm could not be created.

Returns:the number vm creation acks

getVmCreationRequests

protected int getVmCreationRequests()

Gets the number of VM creation requests.

Returns:the number of VM creation requests

getVmDestructionDelayFunction

public Function<Vm, Double> getVmDestructionDelayFunction()

getVmExecList

public <T extends Vm> List<T> getVmExecList()

getVmFromCreatedList

protected Vm getVmFromCreatedList(int vmIndex)

Gets a Vm at a given index from the list of created VMs.

Parameters:
  • vmIndex – the index where a VM has to be got from the created VM list
Returns:

the VM at the given index or Vm.NULL if the index is invalid

getVmWaitingList

public <T extends Vm> List<T> getVmWaitingList()

getWaitingVm

public Vm getWaitingVm(int index)

isThereWaitingCloudlets

public boolean isThereWaitingCloudlets()

processEvent

public void processEvent(SimEvent evt)

requestDatacenterToCreateWaitingVms

protected void requestDatacenterToCreateWaitingVms()

Request the creation of VMs in the VM waiting list inside some Datacenter.

See also: .submitVmList(java.util.List)

requestDatacenterToCreateWaitingVms

protected void requestDatacenterToCreateWaitingVms(Datacenter datacenter)

Request a specific Datacenter to create the VM in the VM waiting list.

Parameters:
  • datacenter – id of the Datacenter to request the VMs creation

See also: .submitVmList(java.util.List)

requestDatacenterToCreateWaitingVms

protected void requestDatacenterToCreateWaitingVms(Datacenter datacenter, boolean isFallbackDatacenter)

Request a specific Datacenter to create the VM in the VM waiting list.

Parameters:
  • datacenter – id of the Datacenter to request the VMs creation
  • isFallbackDatacenter – true to indicate that the given Datacenter is a fallback one, i.e., it’s a next Datacenter where the creation of VMs is being tried (after some VMs could not be created into the previous Datacenter); false to indicate that this is a regular Datacenter where VM creation has to be tried.

See also: .submitVmList(java.util.List)

requestDatacentersToCreateWaitingCloudlets

protected void requestDatacentersToCreateWaitingCloudlets()

Request Datacenters to create the Cloudlets in the Cloudlets waiting list. If there aren’t available VMs to host all cloudlets, the creation of some ones will be postponed.

This method is called after all submitted VMs are created in some Datacenter.

See also: .submitCloudletList(java.util.List)

setCloudletComparator

public void setCloudletComparator(Comparator<Cloudlet> comparator)

setDatacenterList

protected final void setDatacenterList(Set<Datacenter> datacenterList)

Sets the list of available datacenters.

Parameters:
  • datacenterList – the new dc list

setDatacenterSupplier

public final void setDatacenterSupplier(Supplier<Datacenter> datacenterSupplier)

setFallbackDatacenterSupplier

public final void setFallbackDatacenterSupplier(Supplier<Datacenter> fallbackDatacenterSupplier)

setVmComparator

public void setVmComparator(Comparator<Vm> comparator)

setVmDestructionDelayFunction

public DatacenterBroker setVmDestructionDelayFunction(Function<Vm, Double> function)

setVmMapper

public final void setVmMapper(Function<Cloudlet, Vm> vmMapper)

shutdownEntity

public void shutdownEntity()

startEntity

public void startEntity()

submitCloudlet

public void submitCloudlet(Cloudlet cloudlet)

submitCloudletList

public void submitCloudletList(List<? extends Cloudlet> list, double submissionDelay)

submitCloudletList

public void submitCloudletList(List<? extends Cloudlet> list, Vm vm)

submitCloudletList

public void submitCloudletList(List<? extends Cloudlet> list, Vm vm, double submissionDelay)

submitCloudletList

public void submitCloudletList(List<? extends Cloudlet> list)

{@inheritDoc}

If the entity already started (the simulation is running), the creation of previously submitted Cloudlets already was requested by the start() method that is called just once. By this way, this method will immediately request the creation of these just submitted Cloudlets if all submitted VMs were already created, in order to allow Cloudlet creation after the simulation has started. This avoid the developer to dynamically create brokers just to create VMs or Cloudlets during simulation execution.

Parameters:

See also: .submitCloudletList(List,double)

submitVm

public void submitVm(Vm vm)

submitVmList

public void submitVmList(List<? extends Vm> list, double submissionDelay)

submitVmList

public void submitVmList(List<? extends Vm> list)

{@inheritDoc}

If the entity already started (the simulation is running), the creation of previously submitted VMs already was requested by the start() method that is called just once. By this way, this method will immediately request the creation of these just submitted VMs in order to allow VM creation after the simulation has started. This avoid the developer to dynamically create brokers just to create VMs or Cloudlets during simulation execution.

Parameters:

toString

public String toString()