public Completion<Boolean> refresh(boolean recompile) { Completion<Boolean> refresh = module.runtime.refresh(recompile); if (refresh.isFailed()) { return refresh; } else { while (application.get() == null) { application.compareAndSet(null, new ApplicationRuntime( log, module.getRunMode(), module.runtime, injector, config.name, server, resolver)); } return application.get().refresh(); } }
public Completion<Boolean> refresh(boolean recompile) { Completion<Boolean> refresh = module.runtime.refresh(recompile); if (refresh.isFailed()) { return refresh; } else { while (application.get() == null) { application.compareAndSet(null, new ApplicationRuntime( log, module.getRunMode(), module.runtime, injector, config.name, server, resolver)); } return application.get().refresh(); } }
public MockApplication<P> init() throws Exception { if (lifeCycle == null) { assertCompile(); } if (lifeCycle != null) { Completion refresh = lifeCycle.refresh(); if (refresh.isFailed()) { throw refresh.getCause(); } else { return this; } } else { throw new IllegalStateException("Could not compile application"); } }
public MockApplication<P> init() throws Exception { if (lifeCycle == null) { assertCompile(); } if (lifeCycle != null) { Completion refresh = lifeCycle.refresh(); if (refresh.isFailed()) { throw refresh.getCause(); } else { return this; } } else { throw new IllegalStateException("Could not compile application"); } }
if (refresh.isFailed()) { throw refresh.getCause(); } else if (refresh.get()) {
@Test public void testFutureComplete() { final AtomicInteger count = new AtomicInteger(); Completion<String> completion = Completion.future(new Callable<String>() { public String call() throws Exception { count.incrementAndGet(); return "foo"; } }); assertEquals(0, count.get()); assertEquals("foo", completion.get()); assertEquals(1, count.get()); assertEquals("foo", completion.get()); assertEquals(1, count.get()); assertEquals(null, completion.getCause()); assertEquals(1, count.get()); assertEquals(false, completion.isFailed()); assertEquals(1, count.get()); }
@Test public void testFutureFails() { final Exception reason = new Exception(); final AtomicInteger count = new AtomicInteger(); Completion<String> completion = Completion.future(new Callable<String>() { public String call() throws Exception { count.incrementAndGet(); throw reason; } }); assertEquals(0, count.get()); assertEquals(null, completion.get()); assertEquals(1, count.get()); assertEquals(null, completion.get()); assertEquals(1, count.get()); assertEquals(reason, completion.getCause()); assertEquals(1, count.get()); assertEquals(true, completion.isFailed()); assertEquals(1, count.get()); } }
@Test public void testFutureFails() { final Exception reason = new Exception(); final AtomicInteger count = new AtomicInteger(); Completion<String> completion = Completion.future(new Callable<String>() { public String call() throws Exception { count.incrementAndGet(); throw reason; } }); assertEquals(0, count.get()); assertEquals(null, completion.get()); assertEquals(1, count.get()); assertEquals(null, completion.get()); assertEquals(1, count.get()); assertEquals(reason, completion.getCause()); assertEquals(1, count.get()); assertEquals(true, completion.isFailed()); assertEquals(1, count.get()); } }
@Test public void testFutureComplete() { final AtomicInteger count = new AtomicInteger(); Completion<String> completion = Completion.future(new Callable<String>() { public String call() throws Exception { count.incrementAndGet(); return "foo"; } }); assertEquals(0, count.get()); assertEquals("foo", completion.get()); assertEquals(1, count.get()); assertEquals("foo", completion.get()); assertEquals(1, count.get()); assertEquals(null, completion.getCause()); assertEquals(1, count.get()); assertEquals(false, completion.isFailed()); assertEquals(1, count.get()); }
if (refresh.isFailed()) { throw refresh.getCause(); } else if (refresh.get()) {