protected void task(T command) { if (requestedShutdown) { logAddOnShutdown(); } //The shutdown process could finish right after the above check: shutdownNow can drain the remaining tasks tasks.add(command); //cache locally the state to avoid multiple volatile loads final int state = stateUpdater.get(this); if (state != STATE_RUNNING) { onAddedTaskIfNotRunning(state); } }
protected void task(T command) { if (requestedShutdown) { logAddOnShutdown(); } //The shutdown process could finish right after the above check: shutdownNow can drain the remaining tasks tasks.add(command); //cache locally the state to avoid multiple volatile loads final int state = stateUpdater.get(this); if (state != STATE_RUNNING) { onAddedTaskIfNotRunning(state); } }
protected void task(T command) { if (requestedShutdown) { logAddOnShutdown(); } //The shutdown process could finish right after the above check: shutdownNow can drain the remaining tasks tasks.add(command); //cache locally the state to avoid multiple volatile loads final int state = stateUpdater.get(this); if (state != STATE_RUNNING) { onAddedTaskIfNotRunning(state); } }
protected void task(T command) { if (requestedShutdown) { logAddOnShutdown(); } //The shutdown process could finish right after the above check: shutdownNow can drain the remaining tasks tasks.add(command); //cache locally the state to avoid multiple volatile loads final int state = stateUpdater.get(this); if (state != STATE_RUNNING) { onAddedTaskIfNotRunning(state); } }
protected void task(T command) { if (requestedShutdown) { logAddOnShutdown(); } //The shutdown process could finish right after the above check: shutdownNow can drain the remaining tasks tasks.add(command); //cache locally the state to avoid multiple volatile loads final int state = stateUpdater.get(this); if (state != STATE_RUNNING) { onAddedTaskIfNotRunning(state); } }
protected void task(T command) { if (requestedShutdown) { logAddOnShutdown(); } //The shutdown process could finish right after the above check: shutdownNow can drain the remaining tasks tasks.add(command); //cache locally the state to avoid multiple volatile loads final int state = stateUpdater.get(this); if (state != STATE_RUNNING) { onAddedTaskIfNotRunning(state); } }
protected void task(T command) { if (requestedShutdown) { logAddOnShutdown(); } //The shutdown process could finish right after the above check: shutdownNow can drain the remaining tasks tasks.add(command); //cache locally the state to avoid multiple volatile loads final int state = stateUpdater.get(this); if (state != STATE_RUNNING) { onAddedTaskIfNotRunning(state); } }