-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement
Milestone
Description
Sébastien Deleuze opened SPR-11820 and commented
When building a Spring 4 / Java 8 application, we can't use lambda with ListenableFuture since ListenableFutureCallback is not a functional interface (2 methods to implement).
5 proposals to improve this:
- Modify ListenableFutureCallback: it will break API so it is not an option (even if it would be the cleaner solution)
- Add another method to ListenableFuture with a callback parameter with just one method like mongoDB MongoFuture and SingleResultCallback.
- Add new fluent methods to ListenableFuture with single method callbacks allowing to write code like listenableFuture.onSuccess(...).onFailure(...)
- Add default implementation to ListenableFutureCallback#onFailure() interface : not possible since it would require Java 8 for main code
- Change nothing and wait for a future version of Spring that will require Java 8 and use native CompletableFuture
My prefered solution is the 3rd.
Any feedback or advice ?
Affects: 4.0.5
Issue Links:
- Create a synchronous SettableListenableFuture implementation [SPR-11614] #16237 Create a synchronous SettableListenableFuture implementation
- Make ListenableFuture chainable [SPR-12867] #17465 Make ListenableFuture chainable
Referenced from: commits 4e25a14, 86e8bda
1 votes, 5 watchers
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancementA general enhancement