synchronized void addWaiting(ThreadJob threadJob) { synchronized (((InternalJob) threadJob).jobStateLock) { threadJob.isWaiting = true; notifyWaitingThreadJobs(threadJob); ((InternalJob) threadJob).setWaitQueueStamp(manager.waitQueueCounter.increment()); } manager.enqueue(manager.waitingThreadJobs, threadJob); }
synchronized void addWaiting(ThreadJob threadJob) { synchronized (((InternalJob) threadJob).jobStateLock) { threadJob.isWaiting = true; notifyWaitingThreadJobs(threadJob); ((InternalJob) threadJob).setWaitQueueStamp(manager.waitQueueCounter.increment()); } manager.enqueue(manager.waitingThreadJobs, threadJob); }
synchronized void addWaiting(ThreadJob threadJob) { synchronized (((InternalJob) threadJob).jobStateLock) { threadJob.isWaiting = true; notifyWaitingThreadJobs(threadJob); ((InternalJob) threadJob).setWaitQueueStamp(manager.waitQueueCounter.increment()); } manager.enqueue(manager.waitingThreadJobs, threadJob); }
/** * 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); } } }
/** * 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); } } }
/** * 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 (job != null && job.getStartTime() < now) { job.setStartTime(now + delayFor(job.getPriority())); job.setWaitQueueStamp(waitQueueCounter.increment()); changeState(job, Job.WAITING); job = sleeping.peek();
while (job != null && job.getStartTime() < now) { job.setStartTime(now + delayFor(job.getPriority())); job.setWaitQueueStamp(waitQueueCounter.increment()); changeState(job, Job.WAITING); job = sleeping.peek();
while (job != null && job.getStartTime() < now) { job.setStartTime(now + delayFor(job.getPriority())); job.setWaitQueueStamp(waitQueueCounter.increment()); changeState(job, Job.WAITING); job = sleeping.peek();