Package jmt.engine.QueueNet

Examples of jmt.engine.QueueNet.JobClass


          //negative priorities not allowed
          priority = 0;
        }

        //add job class
        jobClasses[i] = new JobClass(currentClassName, priority, type, referenceNode);

        //end NEW

        if (DEBUG) {
          System.out.println("Class " + jobClasses[i].getName() + " created");
View Full Code Here


  }

  //finds the position of the classes from the giving names
  private int findClassPosition(String name) {
    for (int j = 0; j < jobClasses.length; j++) {
      JobClass aClass = jobClasses[j];
      if (aClass.getName().equals(name)) {
        return j;
      }
    }
    //class not found
    return -1;
View Full Code Here

      //classes not loaded yet
      return -1;
    }

    //else search in the array
    JobClass jobClass;
    for (int c = 0; c < jobClasses.length; c++) {
      jobClass = jobClasses[c];
      if (jobClass.getName().equalsIgnoreCase(className)) {
        //it's the class we are searching for
        return c;
      }
    }
View Full Code Here

    Job nextJob = null;
    int nextJobPriority = 0;
    while (iterator.hasNext()) {
      JobInfo info = iterator.next();
      JobClass jobClass = info.getJob().getJobClass();
      if (nextJob == null || nextJobPriority < jobClass.getPriority()) {
        if (!blockingRegion.isBlocked(jobClass)) {
          nextJob = info.getJob();
          nextJobPriority = jobClass.getPriority();
        }
      }
    }
    return nextJob;
  }
View Full Code Here

          //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
View Full Code Here

        //departure of the job, calculated using the strategy of the corresponding class

        //log.write(NetLog.LEVEL_RELEASE, null, this, NetLog.EVENT_START);

        ListIterator<JobClass> jobClasses = getJobClasses().listIterator();
        JobClass jobClass;

        while (jobClasses.hasNext()) {
          jobClass = jobClasses.next();

          //NEW
          //@author Stefano Omini
          if (jobClass.getType() == JobClass.CLOSED_CLASS) {
            //closed class: no arrivals
            continue;
          }
          //end NEW

          c = jobClass.getId();

          // Calculates the delay of departure (1/lambda)
          if (strategy[c] != null) {
            job = new Job(jobClass);
            delay = strategy[c].wait(this);
View Full Code Here

TOP

Related Classes of jmt.engine.QueueNet.JobClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.