/** * Removes and signals all waiting threads, invokes done(), and * nulls out callable. */ private void finishCompletion() { // assert state > COMPLETING; for (WaitNode q; (q = waiters) != null;) { if (UNSAFE.compareAndSwapObject(this, waitersOffset, q, null)) { for (;;) { Thread t = q.thread; if (t != null) { q.thread = null; LockSupport.unpark(t); } WaitNode next = q.next; if (next == null) break; q.next = null; // unlink to help gc q = next; } break; } } done(); callable = null; // to reduce footprint }
@Override protected void done() { super.done(); if (isCancelled()) { return; } try { get(); } catch (ExecutionException ex) { Logger log = owner == null ? GlowServer.logger : owner.getLogger(); log.log(Level.SEVERE, "Error while executing " + this, ex.getCause()); } catch (InterruptedException e) { // Task is already done, see the fact that we're in done() method } } }
protected void set(V value) { if (!_done) { _value = value; _done = true; done(); } }
@Override protected void done() { super.done(); synchronized (this) { this.notifyAll(); } } };
protected void setException(Throwable t) { if (t == null) throw new IllegalArgumentException(); if (!_done) { _throwable = t; _done = true; done(); } }
@Override protected void done() { super.done(); synchronized (this) { this.notifyAll(); } } };
@Override protected void done() { super.done(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { JXImagePanel.this.setImage(get()); } catch (InterruptedException e) { // ignore - canceled image load } catch (ExecutionException e) { LOG.log(Level.WARNING, "", e); } } }); }
@Override protected void done() { super.done(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { JXImagePanel.this.setImage(get()); } catch (InterruptedException e) { // ignore - canceled image load } catch (ExecutionException e) { LOG.log(Level.WARNING, "", e); } } }); }
@Override protected void done() { super.done(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { JXImagePanel.this.setImage(get()); } catch (InterruptedException e) { // ignore - canceled image load } catch (ExecutionException e) { LOG.log(Level.WARNING, "", e); } } }); }
@Override protected void done() { super.done(); SwingUtilities.invokeLater(new Runnable() { public void run() { try { JXImagePanel.this.setImage(get()); } catch (InterruptedException e) { // ignore - canceled image load } catch (ExecutionException e) { LOG.log(Level.WARNING, "", e); } } }); }
@Override protected void done() { super.done(); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { JXImagePanel.this.setImage(get()); } catch (InterruptedException e) { // ignore - canceled image load } catch (ExecutionException e) { LOG.log(Level.WARNING, "", e); } } }); }
@Override protected synchronized void done() { super.done(); for (final ListenerDone listener : listeners) { listener.isDone(this); } }
/** * Removes and signals all waiting threads, invokes done(), and * nulls out callable. */ private void finishCompletion() { // assert state > COMPLETING; for (WaitNode q; (q = waiters) != null;) { if (UNSAFE.compareAndSwapObject(this, waitersOffset, q, null)) { for (;;) { Thread t = q.thread; if (t != null) { q.thread = null; LockSupport.unpark(t); } WaitNode next = q.next; if (next == null) break; q.next = null; // unlink to help gc q = next; } break; } } done(); callable = null; // to reduce footprint }
/** * Removes and signals all waiting threads, invokes done(), and * nulls out callable. */ private void finishCompletion() { // assert state > COMPLETING; for (WaitNode q; (q = waiters) != null;) { if (UNSAFE.compareAndSwapObject(this, waitersOffset, q, null)) { for (;;) { Thread t = q.thread; if (t != null) { q.thread = null; LockSupport.unpark(t); } WaitNode next = q.next; if (next == null) break; q.next = null; // unlink to help gc q = next; } break; } } done(); callable = null; // to reduce footprint }
/** * Removes and signals all waiting threads, invokes done(), and * nulls out callable. */ private void finishCompletion() { // assert state > COMPLETING; for (WaitNode q; (q = waiters) != null;) { if (UNSAFE.compareAndSwapObject(this, waitersOffset, q, null)) { for (;;) { Thread t = q.thread; if (t != null) { q.thread = null; LockSupport.unpark(t); } WaitNode next = q.next; if (next == null) break; q.next = null; // unlink to help gc q = next; } break; } } done(); callable = null; // to reduce footprint }
/** * Removes and signals all waiting threads, invokes done(), and * nulls out callable. */ private void finishCompletion() { // assert state > COMPLETING; for (WaitNode q; (q = waiters) != null;) { if (UNSAFE.compareAndSwapObject(this, waitersOffset, q, null)) { for (;;) { Thread t = q.thread; if (t != null) { q.thread = null; LockSupport.unpark(t); } WaitNode next = q.next; if (next == null) break; q.next = null; // unlink to help gc q = next; } break; } } done(); callable = null; // to reduce footprint }
@Override protected void done() { super.done(); if (contextSwitched.get()) { PhaseInterceptorChain.setCurrentMessage(chain, null); message.remove(Message.THREAD_CONTEXT_SWITCHED); } chain.releaseChain(); }
@Override protected void done() { super.done(); if (contextSwitched.get()) { PhaseInterceptorChain.setCurrentMessage(chain, null); message.remove(Message.THREAD_CONTEXT_SWITCHED); } chain.releaseChain(); }
@Override protected void done() { super.done(); try { /* * called in context of background thread. There is other variant possible where result is * posted back and sits in the queue of caller thread which then picks it up for * processing. An example of such a system is Android OS, where the UI elements can only * be updated using UI thread. So result must be posted back in UI thread. */ task.onPostCall(get()); } catch (InterruptedException e) { // should not occur } catch (ExecutionException e) { task.onError(e.getCause()); } } });
@Override protected void done() { // for calling taskDone for cancelled tasks super.done(); if (taskDoneCallback != null) { taskDoneCallback.taskDone(this); } if (taskListener != null && isCancelled()) { try { if (isContextualCallback) { setupContext(); } taskListener.taskDone(this, executor.getExecutorForTaskListener(), task, new CancellationException()); } finally { if (isContextualCallback) { resetContext(); } } } }