boolean maybeSchedule() { if (pool.spinningCount.get() > 0 || !takeWorkPermit(true)) return false; pool.schedule(new Work(this)); return true; }
boolean maybeSchedule() { if (pool.spinningCount.get() > 0 || !takeWorkPermit(true)) return false; pool.schedule(new Work(this)); return true; }
pool.schedule(new Work(this)); totalBlocked.incrementAndGet(); currentlyBlocked.incrementAndGet();
pool.schedule(new Work(this));
pool.schedule(new Work(this));
pool.schedule(new Work(this));
private boolean selfAssign() { // if we aren't permitted to assign in this state, fail if (!get().canAssign(true)) return false; for (SEPExecutor exec : pool.executors) { if (exec.takeWorkPermit(true)) { Work work = new Work(exec); // we successfully started work on this executor, so we must either assign it to ourselves or ... if (assign(work, true)) return true; // ... if we fail, schedule it to another worker pool.schedule(work); // and return success as we must have already been assigned a task assert get().assigned != null; return true; } } return false; }
private boolean selfAssign() { // if we aren't permitted to assign in this state, fail if (!get().canAssign(true)) return false; for (SEPExecutor exec : pool.executors) { if (exec.takeWorkPermit(true)) { Work work = new Work(exec); // we successfully started work on this executor, so we must either assign it to ourselves or ... if (assign(work, true)) return true; // ... if we fail, schedule it to another worker pool.schedule(work); // and return success as we must have already been assigned a task assert get().assigned != null; return true; } } return false; }
private boolean selfAssign() { // if we aren't permitted to assign in this state, fail if (!get().canAssign(true)) return false; for (SEPExecutor exec : pool.executors) { if (exec.takeWorkPermit(true)) { Work work = new Work(exec); // we successfully started work on this executor, so we must either assign it to ourselves or ... if (assign(work, true)) return true; // ... if we fail, schedule it to another worker pool.schedule(work); // and return success as we must have already been assigned a task assert get().assigned != null; return true; } } return false; }
private boolean selfAssign() { // if we aren't permitted to assign in this state, fail if (!get().canAssign(true)) return false; for (SEPExecutor exec : pool.executors) { if (exec.takeWorkPermit(true)) { Work work = new Work(exec); // we successfully started work on this executor, so we must either assign it to ourselves or ... if (assign(work, true)) return true; // ... if we fail, schedule it to another worker pool.schedule(work); // and return success as we must have already been assigned a task assert get().assigned != null; return true; } } return false; }
boolean maybeSchedule() { if (pool.spinningCount.get() > 0 || !takeWorkPermit(true)) return false; pool.schedule(new Work(this)); return true; }
boolean maybeSchedule() { if (pool.spinningCount.get() > 0 || !takeWorkPermit(true)) return false; pool.schedule(new Work(this)); return true; }