How to pause and resume the simulation

  • Runnable monitor=new Runnable(){
    Public void run(){
    CloudSim.pauseSimulation(200);
    While(true){
    If(CloudSim.isPaused()){
    Break;
    }
    try{
    Thred.sleep(100);
    }catch(InterruptedException e){
    e.printStackTrace();
    }
    Log.printLine(ā€œ\n\nā€+CloudSim.clock()+ā€:The Simulation is paused for 5 sec \n\nā€);
    try{
    Thread.sleep(5000);
    }catch(InterruptedException e){
    e.printStackTrace();
    }
    //Add the cloudlet to the list and submit the list to the broker.
    CloudSim.resumeSimulation();
    };
    new Thread(monitor).start();
    Thread.sleep(1000);