private Object readResolve() { this.future = new FutureImpl(task); return this; }
public void setExecutor(@CheckForNull Executor e) { executor = e; if (e != null) { context.future.addExecutor(e); } }
/** * All the {@link Executor}s that jointly execute a {@link Task} call this method to synchronize on the end of the task. * * @throws InterruptedException * If any of the member thread is interrupted while waiting for other threads to join, all * the member threads will report {@link InterruptedException}. */ public void synchronizeEnd(Executor e, Queue.Executable executable, Throwable problems, long duration) throws InterruptedException { endLatch.synchronize(); // the main thread will send a notification WorkUnit wu = e.getCurrentWorkUnit(); if (wu.isMainWork()) { if (problems == null) { future.set(executable); e.getOwner().taskCompleted(e, task, duration); } else { future.set(problems); e.getOwner().taskCompletedWithProblems(e, task, duration, problems); } } }
/** * Cancels this item, which updates {@link #future} to notify the listener, and * also leaves the queue. * * @return true * if the item was successfully cancelled. */ /*package*/ boolean cancel(Queue q) { boolean r = leave(q); if (r) { future.setAsCancelled(); LeftItem li = new LeftItem(this); li.enter(q); } return r; }
public final Executable waitForStart() throws InterruptedException, ExecutionException { return getStartCondition().get(); }
/** * Participates in the cancellation logic to set the {@link #future} * accordingly. */ /*package*/ void onCancelled() { future.setAsCancelled(); }
public final Executable waitForStart() throws InterruptedException, ExecutionException { return getStartCondition().get(); }
public WaitingItem(Calendar timestamp, Task project, List<Action> actions) { super(project, actions, COUNTER.incrementAndGet(), new FutureImpl(project)); this.timestamp = timestamp; }
public void setExecutor(@CheckForNull Executor e) { executor = e; if (e != null) { context.future.addExecutor(e); } }
/** * Participates in the cancellation logic to set the {@link #future} accordingly. */ /*package*/ void onCancelled() { future.setAsCancelled(); }
/** * All the {@link Executor}s that jointly execute a {@link Task} call this method to synchronize on the end of the task. * * @throws InterruptedException * If any of the member thread is interrupted while waiting for other threads to join, all * the member threads will report {@link InterruptedException}. */ public void synchronizeEnd(Executor e, Queue.Executable executable, Throwable problems, long duration) throws InterruptedException { endLatch.synchronize(); // the main thread will send a notification WorkUnit wu = e.getCurrentWorkUnit(); if (wu.isMainWork()) { if (problems == null) { future.set(executable); e.getOwner().taskCompleted(e, task, duration); } else { future.set(problems); e.getOwner().taskCompletedWithProblems(e, task, duration, problems); } } }
private Object readResolve() { this.future = new FutureImpl(task); return this; }
/** * Called by the executor that executes a member {@link SubTask} that belongs to this task * to create its {@link WorkUnit}. */ public WorkUnit createWorkUnit(SubTask execUnit) { future.addExecutor(Executor.currentExecutor()); WorkUnit wu = new WorkUnit(this, execUnit); workUnits.add(wu); return wu; }
/** * Participates in the cancellation logic to set the {@link #future} accordingly. */ /*package*/ void onCancelled() { future.setAsCancelled(); }
/** * All the {@link Executor}s that jointly execute a {@link Task} call this method to synchronize on the end of the task. * * @throws InterruptedException * If any of the member thread is interrupted while waiting for other threads to join, all * the member threads will report {@link InterruptedException}. */ public void synchronizeEnd(Queue.Executable executable, Throwable problems, long duration) throws InterruptedException { endLatch.synchronize(); // the main thread will send a notification Executor e = Executor.currentExecutor(); WorkUnit wu = e.getCurrentWorkUnit(); if (wu.isMainWork()) { if (problems == null) { future.set(executable); e.getOwner().taskCompleted(e, task, duration); } else { future.set(problems); e.getOwner().taskCompletedWithProblems(e, task, duration, problems); } } }
private Object readResolve() { this.future = new FutureImpl(task); return this; }
/** * Called by the executor that executes a member {@link SubTask} that * belongs to this task to create its {@link WorkUnit}. */ public WorkUnit createWorkUnit(SubTask execUnit) { future.addExecutor(Executor.currentExecutor()); WorkUnit wu = new WorkUnit(this, execUnit); workUnits.add(wu); return wu; }
/** * Participates in the cancellation logic to set the {@link #future} accordingly. */ /*package*/ void onCancelled() { future.setAsCancelled(); }
/** * All the {@link Executor}s that jointly execute a {@link Task} call this method to synchronize on the end of the task. * * @throws InterruptedException * If any of the member thread is interrupted while waiting for other threads to join, all * the member threads will report {@link InterruptedException}. */ public void synchronizeEnd(Queue.Executable executable, Throwable problems, long duration) throws InterruptedException { endLatch.synchronize(); // the main thread will send a notification Executor e = Executor.currentExecutor(); WorkUnit wu = e.getCurrentWorkUnit(); if (wu.isMainWork()) { if (problems == null) { future.set(executable); e.getOwner().taskCompleted(e, task, duration); } else { future.set(problems); e.getOwner().taskCompletedWithProblems(e, task, duration, problems); } } }
private Object readResolve() { this.future = new FutureImpl(task); return this; }