- Timestamp:
- 02/02/16 11:41:11 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
DCWoRMS/branches/coolemall/src/example/globalplugin/GridFCFSRandomPlugin.java
r1449 r1562 1 1 package example.globalplugin; 2 2 3 import java.util.Comparator; 3 4 import java.util.List; 4 5 import java.util.Random; … … 18 19 import schedframe.scheduling.queue.TaskQueueList; 19 20 import schedframe.scheduling.tasks.TaskInterface; 20 import schedframe.scheduling.tasks.WorkloadUnit;21 21 22 22 public class GridFCFSRandomPlugin extends BaseGlobalPlugin { … … 49 49 // order of the resources on this list is not determined 50 50 List<SchedulerDescription> availableResources = resources.getResources(null); 51 availableResources.sort(new SchedulerDescriptionComparator()); 51 52 int resourceIdx = -1; 52 53 … … 57 58 resourceIdx = rand.nextInt(availableResources.size()); 58 59 SchedulerDescription sd = availableResources.get(resourceIdx); 59 60 60 Allocation allocation = new Allocation(); 61 61 allocation.setProcessesCount(1); … … 75 75 76 76 } 77 78 class SchedulerDescriptionComparator implements Comparator<SchedulerDescription>{ 79 80 @Override 81 public int compare(SchedulerDescription o1, SchedulerDescription o2) { 82 return(o1.getProvider().getProviderId().compareTo(o2.getProvider().getProviderId())); 83 } 84 }
Note: See TracChangeset
for help on using the changeset viewer.