@Override public boolean cancel(boolean mayInterruptIfRunning) { return this.completableFuture.cancel(mayInterruptIfRunning); }
@Override public void close() { if (future != null) { future.cancel(true); } } }
@Override public boolean cancel(boolean mayInterruptIfRunning) { boolean result = this.delegate.cancel(mayInterruptIfRunning); super.cancel(mayInterruptIfRunning); return result; }
@Override public boolean cancel(boolean mayInterruptIfRunning) { return this.completableFuture.cancel(mayInterruptIfRunning); }
@Override public boolean cancel(boolean mayInterruptIfRunning) { if (mayInterruptIfRunning) { call.cancel(); } return super.cancel(mayInterruptIfRunning); } };
@Override public boolean cancel(boolean mayInterruptIfRunning) { if (mayInterruptIfRunning) { call.cancel(); } return super.cancel(mayInterruptIfRunning); } };
@Override public boolean cancel(boolean mayInterruptIfRunning) { boolean result = this.delegate.cancel(mayInterruptIfRunning); super.cancel(mayInterruptIfRunning); return result; }
@Override public boolean cancel(boolean mayInterruptIfRunning) { if (mayInterruptIfRunning) { call.cancel(); } return super.cancel(mayInterruptIfRunning); } };
@Override public boolean cancel(boolean mayInterruptIfRunning) { if (mayInterruptIfRunning) { call.cancel(); } return super.cancel(mayInterruptIfRunning); } };
@Override public void cancel() { val future = futureRef.get(); if (future != null) { if (!future.cancel(true)) { log.warn("Cannot cancel future: {}", future); } } }
void prepareClose() { CompletableFuture<?> currentFuture = this.currentFuture; if (currentFuture != null && !currentFuture.isDone()) { currentFuture.cancel(true); } }
@Override public void close() { if (!initialEndpointsFuture.isDone()) { initialEndpointsFuture.cancel(true); } } }
@Override public void closed( BoltConnection connection ) { String id = connection.id(); try { CompletableFuture<Boolean> currentFuture = activeWorkItems.remove( id ); if ( currentFuture != null ) { currentFuture.cancel( false ); } } finally { activeConnections.remove( id ); } }
@Override public boolean cancel(boolean mayInterruptIfRunning) { boolean cancelled = super.cancel(mayInterruptIfRunning); if (cancelled) { Subscription s = ref.getAndSet(null); if (s != null) { s.cancel(); } } return cancelled; }
public boolean cancel(boolean mayInterruptIfRunning) { try { return super.cancel(mayInterruptIfRunning); } finally { corrDone(); } }
@Override public boolean cancel(boolean mayInterruptIfRunning) { if (mayInterruptIfRunning) { call.cancel(); } return super.cancel(mayInterruptIfRunning); } };
@Override public boolean cancel(boolean mayInterruptIfRunning) { if (mayInterruptIfRunning) { call.cancel(); } return super.cancel(mayInterruptIfRunning); } };
@Override public boolean cancel(boolean mayInterruptIfRunning) { try { command.cancel(); return super.cancel(mayInterruptIfRunning); } finally { COUNT_UPDATER.set(this, 0); } }
@CacheSpec @CheckNoWriter @Test(dataProvider = "caches") public void getBiFunc_absent_cancelled(AsyncCache<Integer, Integer> cache, CacheContext context) { CompletableFuture<Integer> cancelledFuture = new CompletableFuture<>(); cache.get(context.absentKey(), (k, executor) -> cancelledFuture); cancelledFuture.cancel(true); assertThat(context, both(hasMissCount(1)).and(hasHitCount(0))); assertThat(context, both(hasLoadSuccessCount(0)).and(hasLoadFailureCount(1))); assertThat(cache.getIfPresent(context.absentKey()), is(nullValue())); }
@CheckNoWriter @Test(dataProvider = "caches") @CacheSpec(loader = Loader.NULL, executor = CacheExecutor.THREADED) public void getFunc_absent_cancelled(AsyncCache<Integer, Integer> cache, CacheContext context) { AtomicBoolean done = new AtomicBoolean(); CompletableFuture<Integer> valueFuture = cache.get(context.absentKey(), k -> { Awaits.await().until(done::get); return null; }); valueFuture.whenComplete((r, e) -> done.set(true)); valueFuture.cancel(true); Awaits.await().untilTrue(done); await().until(() -> context, both(hasMissCount(1)).and(hasHitCount(0))); await().until(() -> context, both(hasLoadSuccessCount(0)).and(hasLoadFailureCount(1))); assertThat(valueFuture.isDone(), is(true)); assertThat(cache.getIfPresent(context.absentKey()), is(nullValue())); }