public static void main(String[] args){
  Log.printLine("Starting CloudSimExample5...");
  try {
    int num_user=2;
    Calendar calendar=Calendar.getInstance();
    boolean trace_flag=false;
    CloudSim.init(num_user,calendar,trace_flag);
    @SuppressWarnings("unused") Datacenter datacenter0=createDatacenter("Datacenter_0");
    @SuppressWarnings("unused") Datacenter datacenter1=createDatacenter("Datacenter_1");
    DatacenterBroker broker1=createBroker(1);
    int brokerId1=broker1.getId();
    DatacenterBroker broker2=createBroker(2);
    int brokerId2=broker2.getId();
    vmlist1=new ArrayList<Vm>();
    vmlist2=new ArrayList<Vm>();
    int vmid=0;
    int mips=250;
    long size=10000;
    int ram=512;
    long bw=1000;
    int pesNumber=1;
    String vmm="Xen";
    Vm vm1=new Vm(vmid,brokerId1,mips,pesNumber,ram,bw,size,vmm,new CloudletSchedulerTimeShared());
    Vm vm2=new Vm(vmid,brokerId2,mips,pesNumber,ram,bw,size,vmm,new CloudletSchedulerTimeShared());
    vmlist1.add(vm1);
    vmlist2.add(vm2);
    broker1.submitVmList(vmlist1);
    broker2.submitVmList(vmlist2);
    cloudletList1=new ArrayList<Cloudlet>();
    cloudletList2=new ArrayList<Cloudlet>();
    int id=0;
    long length=40000;
    long fileSize=300;
    long outputSize=300;
    UtilizationModel utilizationModel=new UtilizationModelFull();
    Cloudlet cloudlet1=new Cloudlet(id,length,pesNumber,fileSize,outputSize,utilizationModel,utilizationModel,utilizationModel);
    cloudlet1.setUserId(brokerId1);
    Cloudlet cloudlet2=new Cloudlet(id,length,pesNumber,fileSize,outputSize,utilizationModel,utilizationModel,utilizationModel);
    cloudlet2.setUserId(brokerId2);
    cloudletList1.add(cloudlet1);
    cloudletList2.add(cloudlet2);
    broker1.submitCloudletList(cloudletList1);
    broker2.submitCloudletList(cloudletList2);
    CloudSim.startSimulation();
    List<Cloudlet> newList1=broker1.getCloudletReceivedList();
    List<Cloudlet> newList2=broker2.getCloudletReceivedList();
    CloudSim.stopSimulation();
    Log.print("=============> User " + brokerId1 + "    ");
    printCloudletList(newList1);
    Log.print("=============> User " + brokerId2 + "    ");
    printCloudletList(newList2);
    Log.printLine("CloudSimExample5 finished!");
  }
 catch (  Exception e) {
    e.printStackTrace();
    Log.printLine("The simulation has been terminated due to an unexpected error");
  }
}

public static void main ( String [ ] args ) { Log . printLine ( "Starting CloudSimExample5..." ) ; try { int num_user = 2 ; Calendar calendar = Calendar . getInstance ( ) ; boolean trace_flag = false ; CloudSim . init ( num_user , calendar , trace_flag ) ; @ SuppressWarnings ( "unused" ) Datacenter datacenter0 = createDatacenter ( "Datacenter_0" ) ; @ SuppressWarnings ( "unused" ) Datacenter datacenter1 = createDatacenter ( "Datacenter_1" ) ; DatacenterBroker broker1 = createBroker ( 1 ) ; int brokerId1 = broker1 . getId ( ) ; DatacenterBroker broker2 = createBroker ( 2 ) ; int brokerId2 = broker2 . getId ( ) ; vmlist1 = new ArrayList < Vm > ( ) ; vmlist2 = new ArrayList < Vm > ( ) ; int vmid = 0 ; int mips = 250 ; long size = 10000 ; int ram = 512 ; long bw = 1000 ; int pesNumber = 1 ; String vmm = "Xen" ; Vm vm1 = new Vm ( vmid , brokerId1 , mips , pesNumber , ram , bw , size , vmm , new CloudletSchedulerTimeShared ( ) ) ; Vm vm2 = new Vm ( vmid , brokerId2 , mips , pesNumber , ram , bw , size , vmm , new CloudletSchedulerTimeShared ( ) ) ; vmlist1 . add ( vm1 ) ; vmlist2 . add ( vm2 ) ; broker1 . submitVmList ( vmlist1 ) ; broker2 . submitVmList ( vmlist2 ) ; cloudletList1 = new ArrayList < Cloudlet > ( ) ; cloudletList2 = new ArrayList < Cloudlet > ( ) ; int id = 0 ; long length = 40000 ; long fileSize = 300 ; long outputSize = 300 ; UtilizationModel utilizationModel = new UtilizationModelFull ( ) ; Cloudlet cloudlet1 = new Cloudlet ( id , length , pesNumber , fileSize , outputSize , utilizationModel , utilizationModel , utilizationModel ) ; cloudlet1 . setUserId ( brokerId1 ) ; Cloudlet cloudlet2 = new Cloudlet ( id , length , pesNumber , fileSize , outputSize , utilizationModel , utilizationModel , utilizationModel ) ; cloudlet2 . setUserId ( brokerId2 ) ; cloudletList1 . add ( cloudlet1 ) ; cloudletList2 . add ( cloudlet2 ) ; broker1 . submitCloudletList ( cloudletList1 ) ; broker2 . submitCloudletList ( cloudletList2 ) ; CloudSim . startSimulation ( ) ; List < Cloudlet > newList1 = broker1 . getCloudletReceivedList ( ) ; List < Cloudlet > newList2 = broker2 . getCloudletReceivedList ( ) ; CloudSim . stopSimulation ( ) ; Log . print ( "=============> User " + brokerId1 + "    " ) ; printCloudletList ( newList1 ) ; Log . print ( "=============> User " + brokerId2 + "    " ) ; printCloudletList ( newList2 ) ; Log . printLine ( "CloudSimExample5 finished!" ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; Log . printLine ( "The simulation has been terminated due to an unexpected error" ) ; } }
creates main ( ) to run this example
