/** * Remove the state which may have attached to the calling thread. If no state * was attached this method does nothing. */ public static void cleanStateForCurrentThread() { ON_TASK_COMPLETION_THREAD_TL.remove(); }
void checkDeadLockDetectorTL() throws ExecutionException { if (deadlockDetector.get().isSet()) { throw new ExecutionException("A potential deadlock was detected.", deadlockExceptionFunction.get()); } } };
void checkDeadLockDetectorTL() throws ExecutionException { if (deadlockDetector.get().isSet()) { throw new ExecutionException("A potential deadlock was detected.", deadlockExceptionFunction.get()); } } };
@Override public void run() { if (ON_TASK_COMPLETION_THREAD_TL.get().isSet()) { // We're running on the task completion thread so off-load to the executor. LOG.trace("Submitting ListenenableFuture Runnable from thread {} to executor {}", Thread.currentThread().getName(), executor); executor.execute(delegate); } else { // We're not running on the task completion thread so run the delegate inline. LOG.trace("Executing ListenenableFuture Runnable on this thread: {}", Thread.currentThread().getName()); delegate.run(); } } }
/** * Remove the state this instance may have attached to the calling thread. If no state * was attached this method does nothing. */ public void cleanStateForCurrentThread() { deadlockDetector.remove(); }
@Override public void run() { if (ON_TASK_COMPLETION_THREAD_TL.get().isSet()) { // We're running on the task completion thread so off-load to the executor. LOG.trace("Submitting ListenenableFuture Runnable from thread {} to executor {}", Thread.currentThread().getName(), executor); executor.execute(delegate); } else { // We're not running on the task completion thread so run the delegate inline. LOG.trace("Executing ListenenableFuture Runnable on this thread: {}", Thread.currentThread().getName()); delegate.run(); } } }
/** * Remove the state which may have attached to the calling thread. If no state * was attached this method does nothing. */ public static void cleanStateForCurrentThread() { ON_TASK_COMPLETION_THREAD_TL.remove(); }
private @NonNull SettableBoolean primeDetector() { final SettableBoolean b = deadlockDetector.get(); checkState(!b.isSet(), "Detector for {} has already been primed", this); b.set(); return b; }
/** * Remove the state this instance may have attached to the calling thread. If no state * was attached this method does nothing. */ public void cleanStateForCurrentThread() { deadlockDetector.remove(); }
private @NonNull SettableBoolean primeDetector() { final SettableBoolean b = deadlockDetector.get(); checkState(!b.isSet(), "Detector for {} has already been primed", this); b.set(); return b; }
/** * Called by the base class when the future result is set. We invoke our listeners. */ @Override protected void done() { final SettableBoolean b = ON_TASK_COMPLETION_THREAD_TL.get(); b.set(); try { executionList.execute(); } finally { b.reset(); } } }
/** * Called by the base class when the future result is set. We invoke our listeners. */ @Override protected void done() { final SettableBoolean b = ON_TASK_COMPLETION_THREAD_TL.get(); b.set(); try { executionList.execute(); } finally { b.reset(); } } }