Coroutine Invocation Handler
class CoroutineInvocationHandler(val asyncContextProvider: Provider<AsyncContext>, val originalObjectProvider: () -> Any, val originalInvocable: Invocable, val shouldIgnoreReturn: Boolean) : InvocationHandler, CoroutineScope
InvocationHandler that runs a jersey resource method implemented by a suspend function in a coroutine, and bridges the return/exception value into an AsyncContext for the request, allowing suspend functions to transparently implement jersey async requests.
Resource classes/methods annotated with AsyncDispatcher can specify which standard coroutine dispatcher to launch the coroutine with, otherwise defaults to Dispatchers.Unconfined. Additionally, if a resource class implements CoroutineScope, that scope is used to launch the coroutine.
Constructors
Link copied to clipboard
fun CoroutineInvocationHandler(asyncContextProvider: Provider<AsyncContext>, originalObjectProvider: () -> Any, originalInvocable: Invocable, shouldIgnoreReturn: Boolean)
Functions
Link copied to clipboard
private suspend fun executeCoroutine(originalObject: Any, args: Array<out Any>?, asyncContext: AsyncContext)