Yusuf.I
04/11/2023, 2:35 PMJoffrey
04/11/2023, 2:38 PM: CompletionStage<T> by CompletableFuture() does what you think it does. You're making RestExecutableRestAction implement CompletionStage<T> by delegating all the implementations to a new instance of CompletableFuture that has nothing to do with the completableFuture property.Joffrey
04/11/2023, 2:38 PMCompletableFuture in Kotlin, but it is usually more idiomatic to use suspend functions and coroutinesYusuf.I
04/11/2023, 2:43 PMYusuf.I
04/11/2023, 2:44 PMJoffrey
04/11/2023, 2:47 PMCompletableFuture within the same action. For instance RestExecutableRestAction provides accessors for its own completableFuture property, and it extends ExtendableAction which has a separate completableFuture property. Using complete on RestExecutableRestAction will not complete the same future and will have no effect on the execute functions.
All in all, the whole hierarchy doesn't seem necessary at all. Why not use CompletableFuture directly in your case instead of this custom hierarchy?Joffrey
04/11/2023, 2:50 PMsuspend fun something(...): SomeType whenever you need to represent an async operation. You probably don't need any abstraction on top of that. But the coroutines world is its own thing to learn, and this cannot fit in a Slack thread. I suggest to do some reading about them first.Yusuf.I
04/11/2023, 2:50 PMYusuf.I
04/11/2023, 2:50 PMYusuf.I
04/11/2023, 2:51 PMYusuf.I
04/11/2023, 2:51 PM