Commit 467beb97 authored by rosemaryng's avatar rosemaryng
Browse files

[Retry Full] Changed determining primary queue occupany by using jobList size

parent 790bcceb
......@@ -496,9 +496,21 @@ public class Queue extends InputSection {
job = message.getJob();
boolean retrial = dropStrategies[0].equals(FINITE_RETRIAL);
if (retrialFullGroup.containsKey(job.getId())) {
System.out.println(job.getId() + " retried, current queue size: " + nodeJobsList.getJobsInPrimaryQueue().size());
JobInfo newJobInfo = nodeJobsList.updateJobInfo(job);
System.out.println(newJobInfo);
System.out.print( " retried at " + getNetSytem().getTime());
System.out.println("queue size: " + nodeJobsList.getJobsInPrimaryQueue().size() +
" jobsList size: " + jobsList.size()
+ " nodeJobsList size: " + nodeJobsList.size()
+ " globalJobsList total visit: " + netJobsList.getTotalVisitCount());
} else {
System.out.println(job.getId() + "current queue size: " + nodeJobsList.getJobsInPrimaryQueue().size());
System.out.println(job.getId() + " current queue size: " + nodeJobsList.getJobsInPrimaryQueue().size());
System.out.println("queue size: " + nodeJobsList.getJobsInPrimaryQueue().size() +
" jobsList size: " + jobsList.size()
+ " nodeJobsList size: " + nodeJobsList.size()
+ " globalJobsList total visit: " + netJobsList.getTotalVisitCount());
}
// System.out.println("this job is: " + nodeJobsList.lookFor(job).toString() + " time: " + this.getNetSytem().getTime());
......@@ -549,12 +561,12 @@ public class Queue extends InputSection {
// <= size because the arriving job has not been inserted in Queue
// job list but has been inserted in NetNode job list !!
if (infinite || !retrial && nodeJobsList.size() <= size ||
retrial && nodeJobsList.getJobsInPrimaryQueue().size() <= size) {
retrial && jobsList.size() <= size) {
// Queue is not full. Okay.
System.out.println("current nodeJobsList size: " + nodeJobsList.size());
if (retrialFullGroup.containsKey(job.getId())) {
System.out.println(job.getId() + " proceeds.");
}
// System.out.println("current nodeJobsList size: " + nodeJobsList.size());
// if (retrialFullGroup.containsKey(job.getId())) {
// System.out.println(job.getId() + " proceeds.");
// }
// If parent node is a fork node adds job to FJ info list
......@@ -624,8 +636,9 @@ public class Queue extends InputSection {
} catch (IncorrectDistributionParameterException e) {
e.printStackTrace();
}
retrialFullGroup.put(job.getId(), job.getSystemEnteringTime() + randomDelay);
double retrialTime = this.getNetSytem().getTime() + randomDelay;
retrialFullGroup.put(job.getId(), retrialTime);
System.out.println(job.getId() + " full, will be retried at: " + retrialTime);
sendMe(NetEvent.EVENT_JOB, job, randomDelay);
} else {
addJobToBuffer(job, message, BufferType.WAITING_REQUESTS);
......
......@@ -61,6 +61,6 @@ public class JobInfo {
@Override
public String toString() {
return "JobID " + job.getId() +
", enteringTime = " + enteringTime + ", original entering time = " + job.getSystemEnteringTime() + ", service time = " + job.getServiceTime();
", enteringTime = " + enteringTime + ", original entering time = " + job.getSystemEnteringTime();
}
}
......@@ -380,4 +380,6 @@ public interface JobInfoList {
public Map<Integer, JobInfo> getJobsInPrimaryQueue();
public Map<Integer, JobInfo> addJobToPrimaryQueue(JobInfo jobInfo);
public JobInfo updateJobInfo(Job oldJob);
}
......@@ -449,6 +449,14 @@ public class LinkedJobInfoList implements JobInfoList {
lastJobInTimePerClass[c] = getTime();
}
@Override
public JobInfo updateJobInfo(Job oldJob) {
remove(lookFor(oldJob));
JobInfo newJobInfo = new JobInfo(oldJob);
add(newJobInfo);
return newJobInfo;
}
public double getTime() {
return netSystem.getTime();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment