Index: DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_ResourceOccupancy.txt
===================================================================
--- DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_ResourceOccupancy.txt	(revision 1375)
+++ DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_ResourceOccupancy.txt	(revision 1378)
@@ -1,10 +1,40 @@
 utlization;compRes;1225666800000;1;
+utlization;compRes;1225667160000;0.5;
+utlization;compRes;1225668000000;0.75;
 utlization;compRes;1225670400000;1;
-utlization;compRes;1225677600000;1;
-utlization;compRes;1225681200000;0;
+utlization;compRes;1225672200000;0.75;
+utlization;compRes;1225675200000;1;
+utlization;compRes;1225677360000;0.5;
+utlization;compRes;1225677600000;0.25;
+utlization;compRes;1225679400000;1;
+utlization;compRes;1225686240000;0;
+mean: 0.8333333333333333
+utlization;compRes/Processor_1;1225666800000;1;
+utlization;compRes/Processor_1;1225667160000;1;
+utlization;compRes/Processor_1;1225672200000;1;
+utlization;compRes/Processor_1;1225679400000;1;
+utlization;compRes/Processor_1;1225686240000;0;
 mean: 1.0
-utlization;compRes/Processor_1;1225666800000;1;
-utlization;compRes/Processor_1;1225670400000;1;
-utlization;compRes/Processor_1;1225677600000;1;
-utlization;compRes/Processor_1;1225681200000;0;
-mean: 1.0
+utlization;compRes/Processor_2;1225666800000;1;
+utlization;compRes/Processor_2;1225667160000;1;
+utlization;compRes/Processor_2;1225672200000;0;
+utlization;compRes/Processor_2;1225675200000;1;
+utlization;compRes/Processor_2;1225677360000;0;
+utlization;compRes/Processor_2;1225679400000;1;
+utlization;compRes/Processor_2;1225686240000;0;
+mean: 0.7407407407407407
+utlization;compRes/Processor_3;1225666800000;1;
+utlization;compRes/Processor_3;1225667160000;0;
+utlization;compRes/Processor_3;1225668000000;1;
+utlization;compRes/Processor_3;1225675200000;1;
+utlization;compRes/Processor_3;1225677360000;0;
+utlization;compRes/Processor_3;1225679400000;1;
+utlization;compRes/Processor_3;1225686240000;0;
+mean: 0.8518518518518519
+utlization;compRes/Processor_4;1225666800000;1;
+utlization;compRes/Processor_4;1225667160000;0;
+utlization;compRes/Processor_4;1225670400000;1;
+utlization;compRes/Processor_4;1225677600000;0;
+utlization;compRes/Processor_4;1225679400000;1;
+utlization;compRes/Processor_4;1225686240000;0;
+mean: 0.7407407407407407
Index: DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_Jobs.txt
===================================================================
--- DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_Jobs.txt	(revision 1375)
+++ DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_Jobs.txt	(revision 1378)
@@ -1,3 +1,6 @@
 jobID;meanTaskCompletionTime;meanTaskExecutionTime;meanTaskStartTime;meanTaskFlowTime;meanTaskWaitingTime;meanTaskGQ_WaitingTime;lateness;tardiness;makespan;
-1;14,400;7,200;0;14,400;0;0;0;0;14,400;
-2;10,800;7,200;0;7,200;0;0;0;0;10,800;
+0;19,440;7,200;0;19,440;0;0;0;0;19,440;
+1;10,560;7,200;0;10,200;0;0;0;0;10,560;
+2;8,400;7,200;0;7,200;0;0;0;0;8,400;
+3;10,800;7,200;0;7,200;0;0;0;0;10,800;
+4;12,600;7,200;0;7,200;0;0;0;0;12,600;
Index: DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_ResourceUtilization.txt
===================================================================
--- DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_ResourceUtilization.txt	(revision 1375)
+++ DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_ResourceUtilization.txt	(revision 1378)
@@ -1,6 +1,35 @@
 utlization;compRes;1225666800000;1;
-utlization;compRes;1225681200000;0;
+utlization;compRes;1225667160000;0.5;
+utlization;compRes;1225668000000;0.75;
+utlization;compRes;1225670400000;1;
+utlization;compRes;1225672200000;0.75;
+utlization;compRes;1225675200000;1;
+utlization;compRes;1225677360000;0.5;
+utlization;compRes;1225677600000;0.25;
+utlization;compRes;1225679400000;1;
+utlization;compRes;1225686240000;0;
+mean: 0.8333333333333333
+utlization;compRes/Processor_1;1225666800000;1;
+utlization;compRes/Processor_1;1225686240000;0;
 mean: 1.0
-utlization;compRes/Processor_1;1225666800000;1;
-utlization;compRes/Processor_1;1225681200000;0;
-mean: 1.0
+utlization;compRes/Processor_2;1225666800000;1;
+utlization;compRes/Processor_2;1225672200000;0;
+utlization;compRes/Processor_2;1225675200000;1;
+utlization;compRes/Processor_2;1225677360000;0;
+utlization;compRes/Processor_2;1225679400000;1;
+utlization;compRes/Processor_2;1225686240000;0;
+mean: 0.7407407407407407
+utlization;compRes/Processor_3;1225666800000;1;
+utlization;compRes/Processor_3;1225667160000;0;
+utlization;compRes/Processor_3;1225668000000;1;
+utlization;compRes/Processor_3;1225677360000;0;
+utlization;compRes/Processor_3;1225679400000;1;
+utlization;compRes/Processor_3;1225686240000;0;
+mean: 0.8518518518518519
+utlization;compRes/Processor_4;1225666800000;1;
+utlization;compRes/Processor_4;1225667160000;0;
+utlization;compRes/Processor_4;1225670400000;1;
+utlization;compRes/Processor_4;1225677600000;0;
+utlization;compRes/Processor_4;1225679400000;1;
+utlization;compRes/Processor_4;1225686240000;0;
+mean: 0.7407407407407407
Index: DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_Simulation.txt
===================================================================
--- DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_Simulation.txt	(revision 1375)
+++ DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_Simulation.txt	(revision 1378)
@@ -2,13 +2,13 @@
 Delayed tasks;0;0;0;0;0;0;1;
 Failed requests (tasks);0;0;0;0;0;0;1;
-Makespan;14,400;0;0;14,400;14,400;14,400;1;
-Resources queue length;0.25;0;0;0.25;0.25;0.25;1;
-Resources total load;1;0;0;1;1;1;1;
+Makespan;19,440;0;0;19,440;19,440;19,440;1;
+Resources queue length;0.432;0;0;0.432;0.432;0.432;1;
+Resources total load;0.833;0;0;0.833;0.833;0.833;1;
 Energy usage;?;?;?;?;?;?;0;
-Task completion time;12,600;1,800;3,240,000;10,800;14,400;25,200;2;
-Task execution time;7,200;0;0;7,200;7,200;14,400;2;
-Task start time;0;0;0;0;0;0;2;
-Task flow time;10,800;3,600;12,960,000;7,200;14,400;21,600;2;
-Task waiting time;0;0;0;0;0;0;2;
-Task lateness;0;0;0;0;0;0;2;
-Task tardiness;0;0;0;0;0;0;2;
+Task completion time;12,360;3,782.571;14,307,840;8,400;19,440;61,800;5;
+Task execution time;7,200;0;0;7,200;7,200;36,000;5;
+Task start time;0;0;0;0;0;0;5;
+Task flow time;10,248;4,740.592;22,473,216;7,200;19,440;51,240;5;
+Task waiting time;0;0;0;0;0;0;5;
+Task lateness;0;0;0;0;0;0;5;
+Task tardiness;0;0;0;0;0;0;5;
Index: DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_Tasks.txt
===================================================================
--- DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_Tasks.txt	(revision 1375)
+++ DCWoRMS/branches/coolemall/src/test/pausing_resuming_result/Stats_Simulation_1_Tasks.txt	(revision 1378)
@@ -1,3 +1,6 @@
 JobID;TaskID;UserDN;SchedName;CpuCnt;ExecStartDate;ExecFinishDate;ExecEndDate;GB_SubDate;LB_SubDate;CompletionTime;ExecStartTime;ExecutionTime;ReadyTime;StartTime;FlowTime;WaitingTime;GQ_WaitingTime;Lateness;Tardiness;ReservStartDate;ReservFinishDate;HostNames;ProcessorName;Energy;AppName;
-1;1;-1;cluster;1;1225666800;1225681200;1225681200;1225666800;1225666800;14400;0;7200;0;0;14400;0;0;0;0;0;0;[];[compRes/Processor_1];0;null;
-2;2;-1;cluster;1;1225670400;1225677600;1225677600;1225670400;1225670400;10800;3600;7200;3600;0;7200;0;0;0;0;0;0;[];[compRes/Processor_1];0;null;
+0;0;-1;cluster;4;1225666800;1225686240;1225686240;1225666800;1225666800;19440;0;7200;0;0;19440;0;0;0;0;0;0;[];[compRes/Processor_1, compRes/Processor_2, compRes/Processor_3, compRes/Processor_4];0;null;
+1;1;-1;cluster;2;1225667160;1225677360;1225677360;1225667160;1225667160;10560;360;7200;360;0;10200;0;0;0;0;0;0;[];[compRes/Processor_1, compRes/Processor_2, compRes/Processor_3];0;null;
+2;2;-1;cluster;1;1225668000;1225675200;1225675200;1225668000;1225668000;8400;1200;7200;1200;0;7200;0;0;0;0;0;0;[];[compRes/Processor_3];0;null;
+3;3;-1;cluster;1;1225670400;1225677600;1225677600;1225670400;1225670400;10800;3600;7200;3600;0;7200;0;0;0;0;0;0;[];[compRes/Processor_4];0;null;
+4;4;-1;cluster;1;1225672200;1225679400;1225679400;1225672200;1225672200;12600;5400;7200;5400;0;7200;0;0;0;0;0;0;[];[compRes/Processor_1];0;null;
Index: DCWoRMS/branches/coolemall/src/test/pausing_resuming/resources1.xml
===================================================================
--- DCWoRMS/branches/coolemall/src/test/pausing_resuming/resources1.xml	(revision 1376)
+++ DCWoRMS/branches/coolemall/src/test/pausing_resuming/resources1.xml	(revision 1378)
@@ -6,6 +6,6 @@
 	<resources>
 		<computingResource class="DataCenter" name="compRes">
-			<!-- Defined data center contains only 6 processors -->
-			<computingResource class="Processor" count="1"/>
+			<!-- Defined data center contains only 4 processors -->
+			<computingResource class="Processor" count="4"/>
 		</computingResource>
 		<scheduler class="Cluster" name="cluster">
Index: DCWoRMS/branches/coolemall/src/test/pausing_resuming/FCFSBF_RandomPluginPausing.java
===================================================================
--- DCWoRMS/branches/coolemall/src/test/pausing_resuming/FCFSBF_RandomPluginPausing.java	(revision 1376)
+++ DCWoRMS/branches/coolemall/src/test/pausing_resuming/FCFSBF_RandomPluginPausing.java	(revision 1378)
@@ -1,9 +1,3 @@
 package test.pausing_resuming;
-
-import dcworms.schedframe.scheduling.ExecTask;
-import dcworms.schedframe.scheduling.Executable;
-import example.localplugin.BaseLocalSchedulingPlugin;
-import gridsim.Gridlet;
-import gridsim.dcworms.DCWormsTags;
 
 import java.util.ArrayList;
@@ -11,18 +5,9 @@
 import java.util.List;
 import java.util.Map;
-import java.util.Properties;
-
-import org.joda.time.DateTime;
 
 import schedframe.events.scheduling.SchedulingEvent;
-import schedframe.exceptions.ResourceException;
 import schedframe.resources.ResourceStatus;
-import schedframe.resources.StandardResourceType;
-import schedframe.resources.computing.Node;
 import schedframe.resources.computing.ComputingResource;
 import schedframe.resources.computing.Processor;
-import schedframe.resources.computing.profiles.energy.EnergyEventType;
-import schedframe.resources.units.Memory;
-import schedframe.resources.units.PEUnit;
 import schedframe.resources.units.ProcessingElements;
 import schedframe.resources.units.ResourceUnit;
@@ -35,9 +20,10 @@
 import schedframe.scheduling.plan.impl.SchedulingPlan;
 import schedframe.scheduling.plugin.grid.ModuleList;
-import schedframe.scheduling.plugin.local.ResourceAllocation;
 import schedframe.scheduling.queue.TaskQueue;
 import schedframe.scheduling.queue.TaskQueueList;
 import schedframe.scheduling.tasks.TaskInterface;
-import simulator.DataCenterWorkloadSimulator;
+import dcworms.schedframe.scheduling.ExecTask;
+import example.localplugin.BaseLocalSchedulingPlugin;
+import gridsim.dcworms.DCWormsTags;
 
 public class FCFSBF_RandomPluginPausing extends BaseLocalSchedulingPlugin {
@@ -67,9 +53,8 @@
 						addToSchedulingPlan(plan, task, choosenResources);
 					} else {
-						if(jobRegistry.getRunningTasks().size() > 0) {
-							for(ExecTask exec: jobRegistry.getRunningTasks()){
-								jobRegistry.pauseTask(exec.getJobId(), exec.getId());
-							}
-						} 
+						ExecTask taskToPause = getTaskWithLowestPriority(jobRegistry.getRunningTasks());
+						if(getTaskPriority(task) > getTaskPriority(taskToPause)){
+							jobRegistry.pauseTask(taskToPause.getJobId(), taskToPause.getId());
+						}
 					}
 				}
@@ -154,5 +139,32 @@
 		return null;
 	}
-
+	
+	
+	private int getTaskPriority(TaskInterface<?> task){
+		int priority;
+		
+		try {
+			double cpuRequest = task.getCpuCntRequest();
+			priority = (-1) * Double.valueOf(cpuRequest).intValue();
+		} catch (NoSuchFieldException e) {
+			priority = Integer.MIN_VALUE;
+		}
+		
+		return priority;
+	}
+	
+	private ExecTask getTaskWithLowestPriority(List<ExecTask> tasks){
+		ExecTask lowestPriorityTask = null;
+		int lowestPriority = Integer.MAX_VALUE;
+		for(ExecTask execTask: tasks){
+			int taskPriority = getTaskPriority(execTask);
+			if(taskPriority < lowestPriority){
+				lowestPriority = getTaskPriority(execTask);
+				lowestPriorityTask = execTask;
+			}
+		}
+		
+		return lowestPriorityTask;
+	}
 
 
Index: DCWoRMS/branches/coolemall/src/test/pausing_resuming/workload.swf
===================================================================
--- DCWoRMS/branches/coolemall/src/test/pausing_resuming/workload.swf	(revision 1375)
+++ DCWoRMS/branches/coolemall/src/test/pausing_resuming/workload.swf	(revision 1378)
@@ -13,6 +13,7 @@
 ;PUSpeed: 1
 ;
-
-
-		1			0			-1		7200	1		-1		-1		1		-1		-1		-1		-1		-1		1		1		1		-1		-1
-		2			3600			-1		7200	1		-1		-1		1		-1		-1		-1		-1		-1		1		1		1		-1		-1
+		0		0		-1		7200		4		-1		-1		4		7200		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		1		360		-1		7200		2		-1		-1		2		7200		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		2		1200		-1		7200		1		-1		-1		1		7200		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		3		3600		-1		7200		1		-1		-1		1		7200		-1		-1		-1		-1		-1		-1		-1		-1		-1
+		4		5400		-1		7200		1		-1		-1		1		7200		-1		-1		-1		-1		-1		-1		-1		-1		-1
