Strom:pluggable scheduler 自己写的自定义分配任务(三)
or. if (availableSlots.isEmpty() && !executors.isEmpty()) { for (Integer port : cluster.getUsedPorts(specialSupervisor)) { cluster.freeSlot(new WorkerSlot(specialSupervisor.getId(), port)); } } // re-get the aviableSlots availableSlots = cluster.getAvailableSlots(specialSupervisor); // since it is just a demo, to keep things simple, we assign all the // executors into one slot. cluster.assign(availableSlots.get(0), topology.getId(), executors); Myschedule(topologies, cluster); flag=1; System.out.println("We assigned executors:" + executors + " to slot: [" + availableSlots.get(0).getNodeId() + ", " + availableSlots.get(0).getPort() + "]"); } else { System.out.println("There is no supervisor named special-supervisor!!!"); } } } }//end flag==0 else { System.out.println(" only do once :"+flag); } }//end special=null // let system's even scheduler handle the rest scheduling work // you can also use your own other scheduler here, this is what // makes storm's scheduler composable. System.out.println("using the default system Schedule!!!"); new EvenScheduler().schedule(topologies, cluster); } }//end class