Mario Andhika
02/06/2025, 10:10 AMSam
02/06/2025, 10:20 AMGlobalScope.future {…}
to create and return a CompletableFuture
. If the Kotlin code should be responsible, I'd have the library create and manage its own coroutine scope, and just offer a simple callback on the Java side, or none at all if the function doesn't need to return a value.Sam
02/06/2025, 10:22 AMbod
02/06/2025, 10:23 AMrunBlocking
could also be an option?rkechols
02/06/2025, 2:42 PMrunBlocking
should be used sparingly, since it totally blocks the calling thread, preventing it from doing any other work.
Like Sam suggested, it would likely be better for the function to either receive a callback function or return a futureZach Klippenstein (he/him) [MOD]
02/06/2025, 4:48 PMMario Andhika
02/07/2025, 2:22 AMSam
02/07/2025, 6:39 AM