src.run();
originalBackend.snapshot(0L, 0L, checkpointStreamFactory, CheckpointOptions.forCheckpointWithDefaultLocation()); snapshot.run(); snapshotResult = snapshot.get();
@Override public void run() { assertTrue(hasStarted == false); hasStarted = true; future.run(); }
@Test public void testCancelAfterRunning() throws Exception { RunnableFuture<Integer> interruptible = getInterruptible(); interruptible.run(); interruptible.cancel(true); assertThat(interruptible.get(), is(1)); }
new Runnable() { public void run() { ((RunnableScheduledFuture)future).run(); } };
/** * Executes wrapped {@link Callable}; don't use explicitly */ @Override public void run() { task.run(); }
@Override public void run() { result.run(); }
@Override public void run() { assertTrue(hasStarted == false); hasStarted = true; future.run(); }
@Override public void run() { assertTrue(hasStarted == false); hasStarted = true; future.run(); }
@Override void fireTransition(Callable<T> code) { DelegatingCallable<T> transitionCall = (DelegatingCallable<T>) action; transitionCall.setup(code); task.run(); }
public static <T> T runIfNotDoneAndGet(RunnableFuture<T> future) throws ExecutionException, InterruptedException { if (null == future) { return null; } if (!future.isDone()) { future.run(); } return future.get(); }
public static <T> T runIfNotDoneAndGet(RunnableFuture<T> future) throws ExecutionException, InterruptedException { if (null == future) { return null; } if (!future.isDone()) { future.run(); } return future.get(); }
@Override protected void beforeExecute(Thread thread, Runnable lowPriorityTask) { // Run all high priority tasks in queue first, then low priority for ( RunnableFuture<?> priorityTask; ( priorityTask = priorityTasks.poll() ) != null; ) { if ( isShutdown() ) { priorityTask.cancel( false ); } else { priorityTask.run(); } } super.beforeExecute( thread, lowPriorityTask ); }
public V execute(final LockService lock, final RunnableFuture<V> task) { try { lock.lock(); task.run(); return task.get(); } catch (final Exception e) { throw new RuntimeException(e); } finally { lock.unlock(); } } }
public V execute( final LockService lock, final RunnableFuture<V> task ) { try { lock.lock(); task.run(); return task.get(); } catch ( final Exception e ) { throw new RuntimeException( e ); } finally { lock.unlock(); } } }
public V execute(final LockService lock, final RunnableFuture<V> task) { try { lock.lock(); task.run(); return task.get(); } catch (final Exception e) { throw new RuntimeException(e); } finally { lock.unlock(); } } }
@Test public void getCallableResultTest() throws InterruptedException, ExecutionException { ExecuteOnGetFutureFactory ff = makeFutureFactory(); final Object result = new Object(); RunnableFuture<Object> future = ff.make(new Callable<Object>() { @Override public Object call() { return result; } }); future.run(); assertTrue(future.get() == result); }
@Test public void getRunnableResultTest() throws InterruptedException, ExecutionException { ExecuteOnGetFutureFactory ff = makeFutureFactory(); final Object result = new Object(); RunnableFuture<Object> future = ff.make(DoNothingRunnable.instance(), result); future.run(); assertTrue(future.get() == result); }
@Test public void isDoneFail() { ExecuteOnGetFutureFactory ff = makeFutureFactory(); TestRunnable r = new TestRuntimeFailureRunnable(); RunnableFuture<?> future = ff.make(r); future.run(); assertTrue(future.isDone()); }
@Test public void isDoneTest() { ExecuteOnGetFutureFactory ff = makeFutureFactory(); TestRunnable r = new TestRunnable(); RunnableFuture<?> future = ff.make(r); future.run(); assertTrue(future.isDone()); }