1 | package schedframe.scheduling; |
---|
2 | |
---|
3 | import java.util.List; |
---|
4 | import java.util.Map; |
---|
5 | |
---|
6 | import schedframe.resources.ResourceType; |
---|
7 | import schedframe.resources.providers.LocalSystem; |
---|
8 | import schedframe.resources.units.ResourceUnit; |
---|
9 | import schedframe.resources.units.ResourceUnitName; |
---|
10 | import schedframe.scheduling.manager.resources.ManagedResources; |
---|
11 | import schedframe.scheduling.policy.AbstractManagementSystem; |
---|
12 | import eduni.simjava.Sim_event; |
---|
13 | import gridsim.GridSimTags; |
---|
14 | import gridsim.IO_data; |
---|
15 | import gridsim.dcworms.DCWormsTags; |
---|
16 | |
---|
17 | public class Cluster extends Scheduler{ |
---|
18 | |
---|
19 | public Cluster(AbstractManagementSystem manSys, ResourceType schedType, ManagedResources managedResources) throws Exception { |
---|
20 | super(manSys, schedType, managedResources); |
---|
21 | } |
---|
22 | |
---|
23 | protected void processOtherRequest(Sim_event ev) { |
---|
24 | switch (ev.get_tag()) { |
---|
25 | case DCWormsTags.QUERY_RESOURCE_DESC: |
---|
26 | SchedulerDescription desc = new SchedulerDescription(new LocalSystem(get_name(), null, null)); |
---|
27 | Map<ResourceUnitName, List<ResourceUnit>> units = managementSystem.getResourceManager().getSharedResourceUnits(); |
---|
28 | desc.addResourceUnitList(units); |
---|
29 | desc.addQueuesDescription(getQueuesDescription()); |
---|
30 | |
---|
31 | IO_data data = new IO_data(desc, 0, ev.get_src()); |
---|
32 | send(ev.get_src(), GridSimTags.SCHEDULE_NOW, DCWormsTags.QUERY_RESOURCE_DESC_RESULT, data); |
---|
33 | break; |
---|
34 | |
---|
35 | default: |
---|
36 | managementSystem.processEvent(ev); |
---|
37 | break; |
---|
38 | } |
---|
39 | } |
---|
40 | |
---|
41 | } |
---|