/** * Returns the priority of this job. The priority is used as a hint when the job * is scheduled to be run. * * @return the priority of the job. One of INTERACTIVE, SHORT, LONG, BUILD, * or DECORATE. */ public final int getPriority() { return super.getPriority(); }
/** * Returns the priority of this job. The priority is used as a hint when the job * is scheduled to be run. * * @return the priority of the job. One of INTERACTIVE, SHORT, LONG, BUILD, * or DECORATE. */ public final int getPriority() { return super.getPriority(); }
/** * Returns the priority of this job. The priority is used as a hint when the job * is scheduled to be run. * * @return the priority of the job. One of INTERACTIVE, SHORT, LONG, BUILD, * or DECORATE. */ @Override public final int getPriority() { return super.getPriority(); }
/** * Returns the priority of this job. The priority is used as a hint when the job * is scheduled to be run. * * @return the priority of the job. One of INTERACTIVE, SHORT, LONG, BUILD, * or DECORATE. */ @Override public final int getPriority() { return super.getPriority(); }
/** * Performs the scheduling of a job. Does not perform any notifications. */ private void doSchedule(InternalJob job, long delay) { synchronized (lock) { //job may have been canceled already int state = job.internalGetState(); if (state != InternalJob.ABOUT_TO_SCHEDULE && state != Job.SLEEPING) return; //if it's a decoration job with no rule, don't run it right now if the system is busy if (job.getPriority() == Job.DECORATE && job.getRule() == null) { long minDelay = running.size() * 100; delay = Math.max(delay, minDelay); } if (delay > 0) { job.setStartTime(System.currentTimeMillis() + delay); changeState(job, Job.SLEEPING); } else { job.setStartTime(System.currentTimeMillis() + delayFor(job.getPriority())); job.setWaitQueueStamp(waitQueueCounter++); changeState(job, Job.WAITING); } } }
/** * Performs the scheduling of a job. Does not perform any notifications. */ private void doSchedule(InternalJob job, long delay) { synchronized (lock) { //job may have been canceled already int state = job.internalGetState(); if (state != InternalJob.ABOUT_TO_SCHEDULE && state != Job.SLEEPING) return; //if it's a decoration job with no rule, don't run it right now if the system is busy if (job.getPriority() == Job.DECORATE && job.getRule() == null) { long minDelay = running.size() * 100; delay = Math.max(delay, minDelay); } if (delay > 0) { job.setStartTime(System.currentTimeMillis() + delay); changeState(job, Job.SLEEPING); } else { job.setStartTime(System.currentTimeMillis() + delayFor(job.getPriority())); job.setWaitQueueStamp(waitQueueCounter.increment()); changeState(job, Job.WAITING); } } }
/** * Returns true if the given job is blocking the execution of a non-system * job. */ protected boolean isBlocking(InternalJob runningJob) { synchronized (lock) { // if this job isn't running, it can't be blocking anyone if (runningJob.getState() != Job.RUNNING) return false; // if any job is queued behind this one, it is blocked by it InternalJob previous = runningJob.previous(); while (previous != null) { // ignore jobs of lower priority (higher priority value means lower priority) if (previous.getPriority() < runningJob.getPriority()) { if (!previous.isSystem()) return true; // implicit jobs should interrupt unless they act on behalf of system jobs if (previous instanceof ThreadJob && ((ThreadJob) previous).shouldInterrupt()) return true; } previous = previous.previous(); } // none found return false; } }
/** * Performs the scheduling of a job. Does not perform any notifications. */ private void doSchedule(InternalJob job, long delay) { synchronized (lock) { //job may have been canceled already int state = job.internalGetState(); if (state != InternalJob.ABOUT_TO_SCHEDULE && state != Job.SLEEPING) return; //if it's a decoration job with no rule, don't run it right now if the system is busy if (job.getPriority() == Job.DECORATE && job.getRule() == null) { long minDelay = running.size() * 100; delay = Math.max(delay, minDelay); } if (delay > 0) { job.setStartTime(System.currentTimeMillis() + delay); changeState(job, Job.SLEEPING); } else { job.setStartTime(System.currentTimeMillis() + delayFor(job.getPriority())); job.setWaitQueueStamp(waitQueueCounter.increment()); changeState(job, Job.WAITING); } } }
/** * Returns true if the given job is blocking the execution of a non-system * job. */ protected boolean isBlocking(InternalJob runningJob) { synchronized (lock) { // if this job isn't running, it can't be blocking anyone if (runningJob.getState() != Job.RUNNING) return false; // if any job is queued behind this one, it is blocked by it InternalJob previous = runningJob.previous(); while (previous != null) { // ignore jobs of lower priority (higher priority value means lower priority) if (previous.getPriority() < runningJob.getPriority()) { if (!previous.isSystem()) return true; // implicit jobs should interrupt unless they act on behalf of system jobs if (previous instanceof ThreadJob && ((ThreadJob) previous).shouldInterrupt()) return true; } previous = previous.previous(); } // none found return false; } }
/** * Performs the scheduling of a job. Does not perform any notifications. */ private void doSchedule(InternalJob job, long delay) { synchronized (lock) { //job may have been canceled already int state = job.internalGetState(); if (state != InternalJob.ABOUT_TO_SCHEDULE && state != Job.SLEEPING) return; //if it's a decoration job with no rule, don't run it right now if the system is busy if (job.getPriority() == Job.DECORATE && job.getRule() == null) { long minDelay = running.size() * 100; delay = Math.max(delay, minDelay); } if (delay > 0) { job.setStartTime(System.currentTimeMillis() + delay); changeState(job, Job.SLEEPING); } else { job.setStartTime(System.currentTimeMillis() + delayFor(job.getPriority())); job.setWaitQueueStamp(waitQueueCounter.increment()); changeState(job, Job.WAITING); } } }
while (previous != null) { if (previous.getPriority() < runningJob.getPriority()) { if (!previous.isSystem()) return true;
while (previous != null) { if (previous.getPriority() < runningJob.getPriority()) { if (!previous.isSystem()) return true;
/** * Changes a job priority. */ protected void setPriority(InternalJob job, int newPriority) { synchronized (lock) { int oldPriority = job.getPriority(); if (oldPriority == newPriority) return; job.internalSetPriority(newPriority); //if the job is waiting to run, re-shuffle the queue if (job.getState() == Job.WAITING) { long oldStart = job.getStartTime(); job.setStartTime(oldStart + (delayFor(newPriority) - delayFor(oldPriority))); waiting.resort(job); } } }
/** * Changes a job priority. */ protected void setPriority(InternalJob job, int newPriority) { synchronized (lock) { int oldPriority = job.getPriority(); if (oldPriority == newPriority) return; job.internalSetPriority(newPriority); //if the job is waiting to run, re-shuffle the queue if (job.getState() == Job.WAITING) { long oldStart = job.getStartTime(); job.setStartTime(oldStart + (delayFor(newPriority) - delayFor(oldPriority))); waiting.resort(job); } } }
/** * Changes a job priority. */ protected void setPriority(InternalJob job, int newPriority) { synchronized (lock) { int oldPriority = job.getPriority(); if (oldPriority == newPriority) return; job.internalSetPriority(newPriority); //if the job is waiting to run, re-shuffle the queue if (job.getState() == Job.WAITING) { long oldStart = job.getStartTime(); job.setStartTime(oldStart + (delayFor(newPriority) - delayFor(oldPriority))); waiting.resort(job); } } }
/** * Changes a job priority. */ protected void setPriority(InternalJob job, int newPriority) { synchronized (lock) { int oldPriority = job.getPriority(); if (oldPriority == newPriority) return; job.internalSetPriority(newPriority); //if the job is waiting to run, re-shuffle the queue if (job.getState() == Job.WAITING) { long oldStart = job.getStartTime(); job.setStartTime(oldStart + (delayFor(newPriority) - delayFor(oldPriority))); waiting.resort(job); } } }
InternalJob job = sleeping.peek(); while (job != null && job.getStartTime() < now) { job.setStartTime(now + delayFor(job.getPriority())); job.setWaitQueueStamp(waitQueueCounter.increment()); changeState(job, Job.WAITING);
InternalJob job = sleeping.peek(); while (job != null && job.getStartTime() < now) { job.setStartTime(now + delayFor(job.getPriority())); job.setWaitQueueStamp(waitQueueCounter++); changeState(job, Job.WAITING);
InternalJob job = sleeping.peek(); while (job != null && job.getStartTime() < now) { job.setStartTime(now + delayFor(job.getPriority())); job.setWaitQueueStamp(waitQueueCounter.increment()); changeState(job, Job.WAITING);
InternalJob job = sleeping.peek(); while (job != null && job.getStartTime() < now) { job.setStartTime(now + delayFor(job.getPriority())); job.setWaitQueueStamp(waitQueueCounter.increment()); changeState(job, Job.WAITING);