Polishing

This commit is contained in:
Juergen Hoeller
2017-11-05 21:07:26 +01:00
parent 07b479e264
commit 9b7af8b5aa
3 changed files with 24 additions and 23 deletions

View File

@@ -19,6 +19,8 @@ package org.springframework.util.concurrent;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.Future;
import org.springframework.util.Assert;
/**
* Extension of {@link CompletableFuture} which allows for cancelling
* a delegate along with the {@link CompletableFuture} itself.
@@ -30,10 +32,13 @@ class DelegatingCompletableFuture<T> extends CompletableFuture<T> {
private final Future<T> delegate;
public DelegatingCompletableFuture(Future<T> delegate) {
Assert.notNull(delegate, "Delegate must not be null");
this.delegate = delegate;
}
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
boolean result = this.delegate.cancel(mayInterruptIfRunning);