Skip to content

Add support for Kotlin coroutines [SPR-15413] #19975

Closed
@spring-projects-issues

Description

@spring-projects-issues

Konrad Kamiński opened SPR-15413 and commented

Since 1.1 Kotlin supports coroutines. Its library support includes utility functions for converting suspending functions/lambdas to/from CompletableFuture / Deferred. It would be nice to have such support ListenableFuture as well.

The API could look as follows:

// a function for creating ListenableFuture from suspending lambda
fun <T> listenableFuture(context: CoroutineContext = CommonPool, block: suspend () -> T): ListenableFuture<T>

// a function for creating ListenableFuture from Deferred
fun <T> Deferred<T>.asListenableFuture(): ListenableFuture<T>

// an extension suspending function which awaits for ListenableFuture completion
suspend fun <T> ListenableFuture<T>.await(): T

Affects: 5.0 M5

Issue Links:

Referenced from: pull request #1375

18 votes, 26 watchers

Metadata

Metadata

Assignees

Labels

has: votes-jiraIssues migrated from JIRA with more than 10 votes at the time of importin: coreIssues in core modules (aop, beans, core, context, expression)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions