//all jobs in queue are class blocked
//nothing else to do
break;
} else {
//get class
JobClass jobClass = notBlockedJob.getJobClass();
//forward job and increase occupation
forward(notBlockedJob);
blockingRegion.increaseOccupation(jobClass);
break;
}
//the BlockingQueue has almost the same behaviour with the events
//EVENT_JOB_OUT_OF_REGION and EVENT_ACK
case NetEvent.EVENT_JOB_OUT_OF_REGION:
//FCR Bug fix:
//The dropping of the job was post poned as the time
//spent in the Queuing station was not taken in consideration.
//Secondly point to be noted is that I am
//only dropping Jobs at Node level as the node section jobs
//are automatically dropped but the node level jobs are
//dropped manually.
Job localJob = (Job) message.getData();
JobInfo jobInfo = jobsList_node.lookFor(localJob);
//remove only when you find a job in the list.
if (jobInfo != null) {
jobsList_node.remove(jobInfo);
}
//checks whether there are jobs in queue
if (jobsList.size() == 0) {
//no jobs in queue
coolStart = true;
break;
}
//search for the first job which is not blocked (if exists)
// and forward it
notBlockedJob = getNextNotBlockedJob();
if (notBlockedJob != null) {
JobClass jobClass = notBlockedJob.getJobClass();
forward(notBlockedJob);
blockingRegion.increaseOccupation(jobClass);
break;
} else {
//all jobs in queue are blocked
//nothing else to do
break;
}
case NetEvent.EVENT_ACK:
//checks whether there are jobs in queue
if (jobsList.size() == 0) {
//no jobs in queue
coolStart = true;
break;
}
//search for the first job which is not blocked (if exists)
// and forward it
notBlockedJob = getNextNotBlockedJob();
if (notBlockedJob != null) {
JobClass jobClass = notBlockedJob.getJobClass();
forward(notBlockedJob);
blockingRegion.increaseOccupation(jobClass);
break;
} else {
//all jobs in queue are blocked
//nothing else to do
break;
}
case NetEvent.EVENT_JOB:
//EVENT_JOB
job = message.getJob();
//no ack must be sent to the source of message (the redirecting queue of a node
//inside the region)
JobClass jobClass = job.getJobClass();
//this job has been received by an internal node
//the region input station will have to send it back
NetNode realDestination = message.getSource();
//adds a JobInfo object after modifying the job with redirection informations
job.setOriginalDestinationNode(realDestination);
jobsList.add(new JobInfo(job));
//checks whether the region is blocked for this class
if (blockingRegion.isBlocked(jobClass)) {
//the region is already blocked
//the job must be dropped?
if (classDrop[jobClass.getId()] == true) {
//drop job
drop(job);
break;
}
//otherwise the job remains blocked in queue