cloudsim-plus-master/cloudsim-plus-master/cloudsim-plus-examples/src/main/java/org/cloudsimplus/examples/listeners/VmListenersExample2.java
private void createVmListeners() {
        /*
        Creates the listener object that will be notified when a host is allocated to a VM.
        All VMs will use this same listener.
        The Listener is created using Java 8 Lambda Expressions.
        */
        this.onHostAllocationListener = eventInfo -> Log.printFormattedLine(
                "\t#EventListener: Host %d allocated to Vm %d at time %.2f",
                eventInfo.getHost().getId(), eventInfo.getVm().getId(), eventInfo.getTime());

        /*
        Creates the listener object that will be notified when a host is deallocated for a VM.
        All VMs will use this same listener.
        The Listener is created using Java 8 Lambda Expressions.
        */
        this.onHostDeallocationListener = evt -> Log.printFormattedLine(
                "\t#EventListener: Vm %d moved/removed from Host %d at time %.2f",
                evt.getVm().getId(), evt.getHost().getId(), evt.getTime());
    }
/**
     * Creates all VM listeners to be used by every VM created.
     *
     * @see #createVm(int)
     */
Creates all VM listeners to be used by every VM created.
Creates all VM listeners to be used by every VM created .
private void createVmListeners() {
        /*
        Creates the listener object that will be notified when a host is allocated to a VM.
        All VMs will use this same listener.
        The Listener is created using Java 8 Lambda Expressions.
        */
        this.onHostAllocationListener = eventInfo -> Log.printFormattedLine(
                "\t#EventListener: Host %d allocated to Vm %d at time %.2f",
                eventInfo.getHost().getId(), eventInfo.getVm().getId(), eventInfo.getTime());
        /*
        Creates the listener object that will be notified when a host is deallocated for a VM.
        All VMs will use this same listener.
        The Listener is created using Java 8 Lambda Expressions.
        */
        this.onHostDeallocationListener = evt -> Log.printFormattedLine(
                "\t#EventListener: Vm %d moved/removed from Host %d at time %.2f",
                evt.getVm().getId(), evt.getHost().getId(), evt.getTime());
    }
private void createVmListeners ( ) { /*
        Creates the listener object that will be notified when a host is allocated to a VM.
        All VMs will use this same listener.
        The Listener is created using Java 8 Lambda Expressions.
        */ this . onHostAllocationListener = eventInfo -> Log . printFormattedLine ( "\t#EventListener: Host %d allocated to Vm %d at time %.2f" , eventInfo . getHost ( ) . getId ( ) , eventInfo . getVm ( ) . getId ( ) , eventInfo . getTime ( ) ) ; /*
        Creates the listener object that will be notified when a host is deallocated for a VM.
        All VMs will use this same listener.
        The Listener is created using Java 8 Lambda Expressions.
        */ this . onHostDeallocationListener = evt -> Log . printFormattedLine ( "\t#EventListener: Vm %d moved/removed from Host %d at time %.2f" , evt . getVm ( ) . getId ( ) , evt . getHost ( ) . getId ( ) , evt . getTime ( ) ) ; }
Creates all VM listeners to be used by every VM created.
Creates all VM listeners to be used by every VM created .