Class DatacenterBrokerAbstract
- All Implemented Interfaces:
Cloneable
,Comparable<SimEntity>
,Runnable
,DatacenterBroker
,Identifiable
,Nameable
,SimEntity
- Direct Known Subclasses:
DatacenterBrokerSimple
public abstract class DatacenterBrokerAbstract extends CloudSimEntity implements DatacenterBroker
DatacenterBroker
.- 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 Modifier and Type Field Description static int
SHUTDOWN
A message tag used for the broker to send a message to itself requesting the shutdown.Fields inherited from interface org.cloudbus.cloudsim.brokers.DatacenterBroker
DEF_VM_DESTRUCTION_DELAY, LOGGER, NULL
-
Constructor Summary
Constructors Constructor Description DatacenterBrokerAbstract(CloudSim simulation, String name)
Creates a DatacenterBroker giving a specific name. -
Method Summary
Modifier and Type Method Description DatacenterBroker
addOnVmsCreatedListener(EventListener<DatacenterBrokerEventInfo> listener)
Adds anEventListener
that will be notified every time VMs in the waiting list are all created (placed) in some Host.boolean
bindCloudletToVm(Cloudlet cloudlet, Vm vm)
Specifies that an already submitted cloudlet, which is in thewaiting list
, must run in a specific virtual machine.protected Datacenter
closestDatacenterMapper(Datacenter lastDatacenter, Vm vm)
The policy used to select the closest Datacenter to run eachwaiting VM
, according to their timezone offset.protected abstract Datacenter
defaultDatacenterMapper(Datacenter lastDatacenter, Vm vm)
The default policy used to select a Datacenter to runwaiting VMs
.protected abstract Vm
defaultVmMapper(Cloudlet cloudlet)
The default policy used to select a VM to execute a given Cloudlet.List<Cloudlet>
destroyVm(Vm vm)
Destroys the passed VM.List<Cloudlet>
getCloudletCreatedList()
Gets a read-only list of cloudlets created inside some Vm.<T extends Cloudlet>
List<T>getCloudletFinishedList()
Gets a copy of the list of cloudlets that have finished executing, to avoid the original list to be changed.List<Cloudlet>
getCloudletSubmittedList()
<T extends Cloudlet>
List<T>getCloudletWaitingList()
Gets the list of cloudlets submitted to the broker that are waiting to be created inside some Vm yet.protected Datacenter
getDatacenter(Vm vm)
Gets the Datacenter where a VM is placed.protected List<Datacenter>
getDatacenterList()
Gets the list of available datacenters.<T extends Vm>
List<T>getVmCreatedList()
Gets the list of all VMs created so far, independently if they are running yet or were already destroyed.protected int
getVmCreationAcks()
Gets the number of acknowledges (ACKs) received from Datacenters in response to requests to create VMs.protected int
getVmCreationRequests()
Gets the number of VM creation requests.Function<Vm,Double>
getVmDestructionDelayFunction()
Gets aFunction
which defines when an idle VM should be destroyed.<T extends Vm>
List<T>getVmExecList()
Gets the list of VMs in execution, if they are running Cloudlets or not.<T extends Vm>
List<T>getVmFailedList()
Gets a List of VMs submitted to the broker that have failed to be created inside some Datacenter due to lack of suitable Hosts.protected Vm
getVmFromCreatedList(int vmIndex)
Gets a Vm at a given index from thelist of created VMs
.int
getVmsNumber()
Gets the total number of VMs submitted to the broker, including created, waiting and failed VMs.<T extends Vm>
List<T>getVmWaitingList()
Gets a List of VMs submitted to the broker that are waiting to be created inside some Datacenter yet.Vm
getWaitingVm(int index)
Gets a VM from the waiting list.boolean
isRetryFailedVms()
Checks if the broker has to retry allocating VMs that couldn't be placed due to lack of suitable Hosts.boolean
isSelectClosestDatacenter()
Checks if the broker has to try selecting the closestDatacenter
to placeVm
s, based on their timezone.boolean
isShutdownWhenIdle()
Checks if the broker must be shut down after becoming idle.void
processEvent(SimEvent evt)
Processes events or services that are available for the entity.DatacenterBroker
removeOnVmsCreatedListener(EventListener<? extends EventInfo> listener)
Removes anEventListener
to stop it to be notified when VMs in the waiting list are all created.protected void
requestDatacentersToCreateWaitingCloudlets()
Request Datacenters to create the Cloudlets in theCloudlets waiting list
.DatacenterBroker
requestIdleVmDestruction(Vm vm)
Checks if a VM is idle VM and request it to be destroyed at the time defined by theDatacenterBroker.getVmDestructionDelayFunction()
.void
requestShutdownWhenIdle()
Requests the broker shutdown if it's idle.void
setCloudletComparator(Comparator<Cloudlet> comparator)
Sets aComparator
that will be used to sort every list of submitted Cloudlets before mapping each Cloudlet to a Vm.DatacenterBroker
setDatacenterMapper(BiFunction<Datacenter,Vm,Datacenter> datacenterMapper)
Sets theBiFunction
that selects and returns a Datacenter to place submitted VMs.void
setRetryFailedVms(boolean retryFailedVms)
Sets if the broker has to retry allocating VMs that couldn't be placed due to lack of suitable Hosts.DatacenterBroker
setSelectClosestDatacenter(boolean select)
Defines if the broker has to try selecting the closestDatacenter
to placeVm
s, based on their timezone.DatacenterBroker
setShutdownWhenIdle(boolean shutdownWhenIdle)
Indicates if the broker must be shut down after becoming idle.DatacenterBroker
setVmComparator(Comparator<Vm> comparator)
Sets aComparator
that will be used to sort every list of submitted VMs before requesting the creation of such VMs in some Datacenter.DatacenterBroker
setVmDestructionDelay(double delay)
Sets the delay after which an idle VM should be destroyed.DatacenterBroker
setVmDestructionDelayFunction(Function<Vm,Double> function)
Sets aFunction
to define the delay after which an idle VM should be destroyed.DatacenterBroker
setVmMapper(Function<Cloudlet,Vm> vmMapper)
Sets aFunction
that maps a given Cloudlet to a Vm.void
shutdown()
Shuts down the entity.void
startInternal()
Defines the logic to be performed by the entity when the simulation starts.DatacenterBroker
submitCloudlet(Cloudlet cloudlet)
Submits a singleCloudlet
to the broker.DatacenterBroker
submitCloudletList(List<? extends Cloudlet> list)
Sends a list of cloudlets to the broker so that it requests their creation inside some VM, following the submission delay specified in each cloudlet (if any).DatacenterBroker
submitCloudletList(List<? extends Cloudlet> list, double submissionDelay)
Sends a list of cloudlets to the broker so that it requests their creation inside some VM just after a given delay.DatacenterBroker
submitCloudletList(List<? extends Cloudlet> list, Vm vm)
Sends a list of cloudlets to the broker so that it requests their creation inside a specific VM, following the submission delay specified in each cloudlet (if any).DatacenterBroker
submitCloudletList(List<? extends Cloudlet> list, Vm vm, double submissionDelay)
Sends a list of cloudlets to the broker so that it requests their creation inside a specific VM just after a given delay.DatacenterBroker
submitVm(Vm vm)
DatacenterBroker
submitVmList(List<? extends Vm> list)
Submits a list ofVm
orVmGroup
that their creation inside a Host will be requested to someDatacenter
.DatacenterBroker
submitVmList(List<? extends Vm> list, double submissionDelay)
String
toString()
Methods inherited from class org.cloudbus.cloudsim.core.CloudSimEntity
cancelEvent, clone, compareTo, equals, getId, getName, getNextEvent, getNextEvent, getShutdownTime, getSimulation, getStartTime, getState, hashCode, isAlive, isFinished, isStarted, pause, run, run, schedule, schedule, schedule, schedule, schedule, schedule, scheduleFirst, scheduleFirst, scheduleFirstNow, scheduleFirstNow, scheduleNow, scheduleNow, selectEvent, send, send, sendNow, sendNow, setEventBuffer, setId, setName, setSimulation, 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
getShutdownTime, getSimulation, getStartTime, getState, isAlive, isFinished, isStarted, run, schedule, schedule, schedule, schedule, schedule, schedule, schedule, setName, setSimulation, setState, start
-
Field Details
-
SHUTDOWN
public static final int SHUTDOWNA message tag used for the broker to send a message to itself requesting the shutdown. That ensures a graceful shutdown, after other broker events are processed.- See Also:
- Constant Field Values
-
-
Constructor Details
-
DatacenterBrokerAbstract
Creates a DatacenterBroker giving a specific name. Subclasses usually should provide this constructor and and overloaded version that just requires theCloudSim
parameter.- Parameters:
simulation
- the CloudSim instance that represents the simulation the Entity is related toname
- the DatacenterBroker name
-
-
Method Details
-
setSelectClosestDatacenter
Description copied from interface:DatacenterBroker
Defines if the broker has to try selecting the closestDatacenter
to placeVm
s, based on their timezone. The default behaviour is to ignoreDatacenter
s andVm
s timezones.- Specified by:
setSelectClosestDatacenter
in interfaceDatacenterBroker
- Parameters:
select
- true to try selecting the closest Datacenter to be selected, false to ignore distance- Returns:
-
isSelectClosestDatacenter
public boolean isSelectClosestDatacenter()Description copied from interface:DatacenterBroker
Checks if the broker has to try selecting the closestDatacenter
to placeVm
s, based on their timezone. The default behaviour is to ignoreDatacenter
s andVm
s timezones.- Specified by:
isSelectClosestDatacenter
in interfaceDatacenterBroker
- Returns:
- true if the closest Datacenter selection is enabled, false if it's disabled
- See Also:
DatacenterBroker.setSelectClosestDatacenter(boolean)
-
submitVmList
Description copied from interface:DatacenterBroker
Submits a list ofVm
orVmGroup
to the broker so that their creation inside some Host will be requested just after a given delay. Just the VMs that don't have a delay already assigned will have its submission delay changed. All VMs will be added to theDatacenterBroker.getVmWaitingList()
.When a list of
VmGroup
is given, it will try to place all VMs from the same group into the same Host.- Specified by:
submitVmList
in interfaceDatacenterBroker
- Parameters:
list
- the list of VMs to request the creationsubmissionDelay
- the delay the broker has to include when requesting the creation of VMs- Returns:
- See Also:
DatacenterBroker.submitVmList(java.util.List)
,Delayable.getSubmissionDelay()
,VmGroup
-
submitVmList
Submits a list ofVm
orVmGroup
that their creation inside a Host will be requested to someDatacenter
. The Datacenter that will be chosen to place a VM is determined by theDatacenterBroker.setDatacenterMapper(BiFunction)
.When a list of
VmGroup
is given, it will try to place all VMs from the same group into the same Host.The individual submission delay of VMs inside the group will be ignored. Only the submission delay set for the
VmGroup
will be considered.If the entity already started (the simulation is running), the creation of previously submitted VMs already was requested by the
CloudSimEntity.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.- Specified by:
submitVmList
in interfaceDatacenterBroker
- Parameters:
list
- the list of VMs to request the creation- Returns:
- See Also:
VmGroup
-
submitVm
Description copied from interface:DatacenterBroker
Submits a singleVm
orVmGroup
to the broker. When aVmGroup
is given, it will try to place all VMs inside it into the same Host.- Specified by:
submitVm
in interfaceDatacenterBroker
- Parameters:
vm
- the Vm to be submitted- Returns:
- See Also:
VmGroup
-
submitCloudlet
Description copied from interface:DatacenterBroker
Submits a singleCloudlet
to the broker.- Specified by:
submitCloudlet
in interfaceDatacenterBroker
- Parameters:
cloudlet
- the Cloudlet to be submitted- Returns:
-
submitCloudletList
Description copied from interface:DatacenterBroker
Sends a list of cloudlets to the broker so that it requests their creation inside some VM just after a given delay. Just the Cloudlets that don't have a delay already assigned will have its submission delay changed. All cloudlets will be added to theDatacenterBroker.getCloudletWaitingList()
, setting their submission delay to the specified value.- Specified by:
submitCloudletList
in interfaceDatacenterBroker
- Parameters:
list
- the list of Cloudlets to request the creationsubmissionDelay
- the delay the broker has to include when requesting the creation of Cloudlets- Returns:
- See Also:
DatacenterBroker.submitCloudletList(java.util.List)
,Cloudlet.getSubmissionDelay()
-
submitCloudletList
Description copied from interface:DatacenterBroker
Sends a list of cloudlets to the broker so that it requests their creation inside a specific VM, following the submission delay specified in each cloudlet (if any). All cloudlets will be added to theDatacenterBroker.getCloudletWaitingList()
.- Specified by:
submitCloudletList
in interfaceDatacenterBroker
- Parameters:
list
- the list of Cloudlets to request the creationvm
- the VM to which all Cloudlets will be bound to- Returns:
- See Also:
DatacenterBroker.submitCloudletList(java.util.List, double)
-
submitCloudletList
public DatacenterBroker submitCloudletList(List<? extends Cloudlet> list, Vm vm, double submissionDelay)Description copied from interface:DatacenterBroker
Sends a list of cloudlets to the broker so that it requests their creation inside a specific VM just after a given delay. Just the Cloudlets that don't have a delay already assigned will have its submission delay changed. All cloudlets will be added to theDatacenterBroker.getCloudletWaitingList()
, setting their submission delay to the specified value.- Specified by:
submitCloudletList
in interfaceDatacenterBroker
- Parameters:
list
- the list of Cloudlets to request the creationvm
- the VM to which all Cloudlets will be bound tosubmissionDelay
- the delay the broker has to include when requesting the creation of Cloudlets- Returns:
- See Also:
DatacenterBroker.submitCloudletList(java.util.List)
,Cloudlet.getSubmissionDelay()
-
submitCloudletList
Sends a list of cloudlets to the broker so that it requests their creation inside some VM, following the submission delay specified in each cloudlet (if any). All cloudlets will be added to theDatacenterBroker.getCloudletWaitingList()
.If the entity already started (the simulation is running), the creation of previously submitted Cloudlets already was requested by the
CloudSimEntity.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.- Specified by:
submitCloudletList
in interfaceDatacenterBroker
- Parameters:
list
- the list of Cloudlets to request the creation- Returns:
- See Also:
submitCloudletList(List, double)
-
bindCloudletToVm
Description copied from interface:DatacenterBroker
Specifies that an already submitted cloudlet, which is in thewaiting list
, must run in a specific virtual machine.- Specified by:
bindCloudletToVm
in interfaceDatacenterBroker
- Parameters:
cloudlet
- the cloudlet to be bind to a given Vmvm
- the vm to bind the Cloudlet to- Returns:
- true if the Cloudlet was found in the waiting list and was bind to the given Vm, false it the Cloudlet was not found in such a list (that may mean it wasn't submitted yet or was already created)
-
processEvent
Description copied from interface:SimEntity
Processes events or services that are available for the entity. This method is invoked by theCloudSim
class whenever there is an event in the deferred queue, which needs to be processed by the entity.- Specified by:
processEvent
in interfaceSimEntity
- Parameters:
evt
- information about the event just happened
-
getVmsNumber
public int getVmsNumber()Description copied from interface:DatacenterBroker
Gets the total number of VMs submitted to the broker, including created, waiting and failed VMs.- Specified by:
getVmsNumber
in interfaceDatacenterBroker
- Returns:
-
requestIdleVmDestruction
Description copied from interface:DatacenterBroker
Checks if a VM is idle VM and request it to be destroyed at the time defined by theDatacenterBroker.getVmDestructionDelayFunction()
. The request will be sent if the given delay function returns a value greater thanDatacenterBroker.DEF_VM_DESTRUCTION_DELAY
. Otherwise, it doesn't send the request, meaning the VM should not be destroyed according to a specific delay.- Specified by:
requestIdleVmDestruction
in interfaceDatacenterBroker
- Parameters:
vm
- the VM to destroy- Returns:
- See Also:
DatacenterBroker.getVmDestructionDelayFunction()
-
requestShutdownWhenIdle
public void requestShutdownWhenIdle()Description copied from interface:DatacenterBroker
Requests the broker shutdown if it's idle.- Specified by:
requestShutdownWhenIdle
in interfaceDatacenterBroker
-
destroyVm
Description copied from interface:DatacenterBroker
Destroys the passed VM.- Specified by:
destroyVm
in interfaceDatacenterBroker
- Parameters:
vm
- Virtual machine to be destroyed- Returns:
- Cloudlets which were being queued or running on the target VM. All have reset state.
-
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)
-
shutdown
public void shutdown()Description copied from interface:SimEntity
Shuts down the entity. This method is invoked by theCloudSim
before the simulation finishes. If you want to save data in log files this is the method in which the corresponding code would be placed.- Specified by:
shutdown
in interfaceSimEntity
- Overrides:
shutdown
in classCloudSimEntity
-
startInternal
public void startInternal()Description copied from class:CloudSimEntity
Defines the logic to be performed by the entity when the simulation starts.- Specified by:
startInternal
in classCloudSimEntity
-
getVmCreatedList
Description copied from interface:DatacenterBroker
Gets the list of all VMs created so far, independently if they are running yet or were already destroyed. This can be used at the end of the simulation to know which VMs have executed.- Specified by:
getVmCreatedList
in interfaceDatacenterBroker
- Type Parameters:
T
- the class of VMs inside the list- Returns:
- the list of created VMs
- See Also:
DatacenterBroker.getVmExecList()
-
getVmExecList
Description copied from interface:DatacenterBroker
Gets the list of VMs in execution, if they are running Cloudlets or not. These VMs can receive new submitted Cloudlets.- Specified by:
getVmExecList
in interfaceDatacenterBroker
- Type Parameters:
T
- the class of VMs inside the list- Returns:
- the list of running VMs
- See Also:
DatacenterBroker.getVmCreatedList()
-
getVmWaitingList
Description copied from interface:DatacenterBroker
Gets a List of VMs submitted to the broker that are waiting to be created inside some Datacenter yet.- Specified by:
getVmWaitingList
in interfaceDatacenterBroker
- Type Parameters:
T
- the class of VMs inside the list- Returns:
- the list of waiting VMs
-
getWaitingVm
Description copied from interface:DatacenterBroker
Gets a VM from the waiting list.- Specified by:
getWaitingVm
in interfaceDatacenterBroker
- Parameters:
index
- the index of the VM to get- Returns:
- the waiting VM
-
getCloudletCreatedList
Description copied from interface:DatacenterBroker
Gets a read-only list of cloudlets created inside some Vm.- Specified by:
getCloudletCreatedList
in interfaceDatacenterBroker
- Returns:
- the list of created Cloudlets
-
getCloudletWaitingList
Description copied from interface:DatacenterBroker
Gets the list of cloudlets submitted to the broker that are waiting to be created inside some Vm yet.- Specified by:
getCloudletWaitingList
in interfaceDatacenterBroker
- Type Parameters:
T
- the class of Cloudlets inside the list- Returns:
- the cloudlet waiting list
-
getCloudletFinishedList
Description copied from interface:DatacenterBroker
Gets a copy of the list of cloudlets that have finished executing, to avoid the original list to be changed.- Specified by:
getCloudletFinishedList
in interfaceDatacenterBroker
- Type Parameters:
T
- the class of Cloudlets inside the list- Returns:
- the list of finished cloudlets
-
getVmFromCreatedList
Gets a Vm at a given index from thelist 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
-
getVmCreationRequests
protected int getVmCreationRequests()Gets the number of VM creation requests.- Returns:
- the number of VM creation requests
-
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
-
getDatacenterList
Gets the list of available datacenters.- Returns:
- the dc list
-
getDatacenter
Gets the Datacenter where a VM is placed.- Parameters:
vm
- the VM to get its Datacenter- Returns:
-
setDatacenterMapper
public final DatacenterBroker setDatacenterMapper(BiFunction<Datacenter,Vm,Datacenter> datacenterMapper)Description copied from interface:DatacenterBroker
Sets theBiFunction
that selects and returns a Datacenter to place submitted VMs.It defines the policy to select a Datacenter to host a VM that is waiting to be created. It receives as parameter the last selected Datacenter, the VM trying to be created and should return:
- the Datacenter for the next VMs in the waiting list
- or
Datacenter.NULL
if no suitable Datacenter was found
When there are VMs in the waiting list, the provided Function will be called. If it receives
Datacenter.NULL
it indicates that a Datacenter was never selected to place VMs or the previous selected Datacenter has not enough resources for all the waiting VMs. The Function you provide here should consider that when returning the Datacenter where the creation of waiting VMs will be tried.- Specified by:
setDatacenterMapper
in interfaceDatacenterBroker
- Parameters:
datacenterMapper
- the datacenterMapper to set- Returns:
-
setVmMapper
Description copied from interface:DatacenterBroker
Sets aFunction
that maps a given Cloudlet to a Vm. It defines the policy used to select a Vm to host a Cloudlet that is waiting to be created.- Specified by:
setVmMapper
in interfaceDatacenterBroker
- Parameters:
vmMapper
- the Vm mapper Function to set. Such a Function must receive a Cloudlet and return the Vm where it will be placed into. If the Function is unable to find a VM for a Cloudlet, it should returnVm.NULL
.- Returns:
-
setVmComparator
Description copied from interface:DatacenterBroker
Sets aComparator
that will be used to sort every list of submitted VMs before requesting the creation of such VMs in some Datacenter. After sorting, the VM creation requests will be sent in the order of the sorted VM list.- Specified by:
setVmComparator
in interfaceDatacenterBroker
- Parameters:
comparator
- the VM Comparator to set- Returns:
-
setCloudletComparator
Description copied from interface:DatacenterBroker
Sets aComparator
that will be used to sort every list of submitted Cloudlets before mapping each Cloudlet to a Vm. After sorting, the Cloudlet mapping will follow the order of the sorted Cloudlet list.- Specified by:
setCloudletComparator
in interfaceDatacenterBroker
- Parameters:
comparator
- the Cloudlet Comparator to set
-
addOnVmsCreatedListener
Description copied from interface:DatacenterBroker
Adds anEventListener
that will be notified every time VMs in the waiting list are all created (placed) in some Host.Events are fired according to the following conditions:
- if all VMs are submitted before the simulation start and all those VMs are created after starting, then the event will be fired just once, in the entire simulation execution time, for every registered Listener;
- if new VMs are submitted during simulation execution, the event may be fired multiple times. For instance, consider new VMs are submitted during simulation execution at times 10 and 20. If for every submission time, all VMs could be created, then every Listener will be notified 2 times (one for VMs submitted at time 10 and other for those at time 20).
- Specified by:
addOnVmsCreatedListener
in interfaceDatacenterBroker
- Parameters:
listener
- the Listener that will be notified- Returns:
- See Also:
DatacenterBroker.getVmWaitingList()
-
removeOnVmsCreatedListener
Description copied from interface:DatacenterBroker
Removes anEventListener
to stop it to be notified when VMs in the waiting list are all created.- Specified by:
removeOnVmsCreatedListener
in interfaceDatacenterBroker
- Parameters:
listener
- the Listener that will be removed- Returns:
- See Also:
DatacenterBroker.addOnVmsCreatedListener(EventListener)
-
toString
-
getVmDestructionDelayFunction
Description copied from interface:DatacenterBroker
Gets aFunction
which defines when an idle VM should be destroyed. The Function receives aVm
and returns the delay to wait (in seconds), after the VM becomes idle, to destroy it.- Specified by:
getVmDestructionDelayFunction
in interfaceDatacenterBroker
- Returns:
- See Also:
DatacenterBroker.DEF_VM_DESTRUCTION_DELAY
,AbstractMachine.getIdleInterval()
-
setVmDestructionDelay
Description copied from interface:DatacenterBroker
Sets the delay after which an idle VM should be destroyed. Using such a method, it defines the same delay for any VM that becomes idle. If you need to define different delays for distinct VMs use theDatacenterBroker.setVmDestructionDelayFunction(Function)
method.- Specified by:
setVmDestructionDelay
in interfaceDatacenterBroker
- Parameters:
delay
- the time (in seconds) to wait before destroying idle VMs- Returns:
- See Also:
DatacenterBroker.DEF_VM_DESTRUCTION_DELAY
,AbstractMachine.getIdleInterval()
-
setVmDestructionDelayFunction
Description copied from interface:DatacenterBroker
Sets aFunction
to define the delay after which an idle VM should be destroyed. The Function must receive aVm
and return the delay to wait (in seconds), after the VM becomes idle, to destroy it.By providing a
Function
to define when idle VMs should be destroyed enables you to define different delays for every VM that becomes idle, according to desired conditions.- Specified by:
setVmDestructionDelayFunction
in interfaceDatacenterBroker
- Parameters:
function
- theFunction
to set (if null is given, no idle VM will be automatically destroyed)- Returns:
- See Also:
DatacenterBroker.DEF_VM_DESTRUCTION_DELAY
,AbstractMachine.getIdleInterval()
,DatacenterBroker.setVmDestructionDelay(double)
-
getCloudletSubmittedList
- Specified by:
getCloudletSubmittedList
in interfaceDatacenterBroker
-
closestDatacenterMapper
The policy used to select the closest Datacenter to run eachwaiting VM
, according to their timezone offset. This policy is just used ifselection of the closest datacenter
is enabled.- Parameters:
lastDatacenter
- the last selected Datacentervm
- the VM trying to be created- Returns:
- the Datacenter selected to request the creating of waiting VMs
or
Datacenter.NULL
if no suitable Datacenter was found - See Also:
defaultDatacenterMapper(Datacenter, Vm)
,setSelectClosestDatacenter(boolean)
-
defaultDatacenterMapper
The default policy used to select a Datacenter to runwaiting VMs
.- Parameters:
lastDatacenter
- the last selected Datacentervm
- the VM trying to be created- Returns:
- the Datacenter selected to request the creating of waiting VMs
or
Datacenter.NULL
if no suitable Datacenter was found - See Also:
DatacenterBroker.setDatacenterMapper(BiFunction)
,closestDatacenterMapper(Datacenter, Vm)
-
defaultVmMapper
The default policy used to select a VM to execute a given Cloudlet. The method defines the default policy used to map VMs for Cloudlets that are waiting to be created.Since this policy can be dynamically changed by calling
setVmMapper(Function)
, this method will always return the default policy provided by the subclass where the method is being called.- Parameters:
cloudlet
- the cloudlet that needs a VM to execute- Returns:
- the selected Vm for the cloudlet or
Vm.NULL
if no suitable VM was found - See Also:
setVmMapper(Function)
-
getVmFailedList
Description copied from interface:DatacenterBroker
Gets a List of VMs submitted to the broker that have failed to be created inside some Datacenter due to lack of suitable Hosts. VMs are just moved to that list ifretryFailedVms
is not enabled.- Specified by:
getVmFailedList
in interfaceDatacenterBroker
- Type Parameters:
T
- the class of VMs inside the list- Returns:
- the list of failed VMs
- See Also:
}
-
isRetryFailedVms
public boolean isRetryFailedVms()Description copied from interface:DatacenterBroker
Checks if the broker has to retry allocating VMs that couldn't be placed due to lack of suitable Hosts.- Specified by:
isRetryFailedVms
in interfaceDatacenterBroker
- Returns:
-
setRetryFailedVms
public void setRetryFailedVms(boolean retryFailedVms)Description copied from interface:DatacenterBroker
Sets if the broker has to retry allocating VMs that couldn't be placed due to lack of suitable Hosts. Setting the attribute to:true
, the broker will retry to place the failed VM as soon as new VMs or Cloudlets are submitted.false
, the VM will be just added to theDatacenterBroker.getVmFailedList()
and the user simulation have to deal with it. If the VM has anOnCreationFailureListener
, the VM will be notified about the failure.
- Specified by:
setRetryFailedVms
in interfaceDatacenterBroker
-
isShutdownWhenIdle
public boolean isShutdownWhenIdle()Description copied from interface:DatacenterBroker
Checks if the broker must be shut down after becoming idle.- Specified by:
isShutdownWhenIdle
in interfaceDatacenterBroker
- Returns:
-
setShutdownWhenIdle
Description copied from interface:DatacenterBroker
Indicates if the broker must be shut down after becoming idle.- Specified by:
setShutdownWhenIdle
in interfaceDatacenterBroker
- Returns:
-