Make ListenableFuture compliant with Java 8 lambda
Make it possible to use a ListenableFuture with Java 8 lambda expressions, using a syntax like listenableFuture.addCallback(() -> ..., () -> ...); Issue: SPR-11820
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -21,9 +21,11 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.concurrent.FailureCallback;
|
||||
import org.springframework.util.concurrent.ListenableFuture;
|
||||
import org.springframework.util.concurrent.ListenableFutureCallback;
|
||||
import org.springframework.util.concurrent.ListenableFutureCallbackRegistry;
|
||||
import org.springframework.util.concurrent.SuccessCallback;
|
||||
|
||||
import reactor.core.composable.Promise;
|
||||
import reactor.function.Consumer;
|
||||
@@ -106,4 +108,9 @@ abstract class AbstractPromiseToListenableFutureAdapter<S, T> implements Listena
|
||||
this.registry.addCallback(callback);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCallback(SuccessCallback<? super T> successCallback, FailureCallback failureCallback) {
|
||||
this.registry.addSuccessCallback(successCallback);
|
||||
this.registry.addFailureCallback(failureCallback);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user