From 9b33b0ad58dcda1e3ea803d0c6468e17b24a4ad2 Mon Sep 17 00:00:00 2001 From: Sebastien Deleuze Date: Tue, 3 Sep 2019 23:39:39 +0200 Subject: [PATCH] Rename CoroutinesUtils#invokeHandlerMethod to invokeSuspendingFunction --- .../main/kotlin/org/springframework/core/CoroutinesUtils.kt | 6 +++--- .../handler/invocation/reactive/InvocableHandlerMethod.java | 2 +- .../web/reactive/result/method/InvocableHandlerMethod.java | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spring-core/kotlin-coroutines/src/main/kotlin/org/springframework/core/CoroutinesUtils.kt b/spring-core/kotlin-coroutines/src/main/kotlin/org/springframework/core/CoroutinesUtils.kt index c5cc85c9d5f..aaf693284c3 100644 --- a/spring-core/kotlin-coroutines/src/main/kotlin/org/springframework/core/CoroutinesUtils.kt +++ b/spring-core/kotlin-coroutines/src/main/kotlin/org/springframework/core/CoroutinesUtils.kt @@ -52,15 +52,15 @@ internal fun monoToDeferred(source: Mono) = GlobalScope.async(Dispatchers.Unconfined) { source.awaitFirstOrNull() } /** - * Invoke an handler method converting suspending method to [Mono] or - * [reactor.core.publisher.Flux] if necessary. + * Invoke a suspending function converting it to [Mono] or [reactor.core.publisher.Flux] + * if necessary. * * @author Sebastien Deleuze * @since 5.2 */ @Suppress("UNCHECKED_CAST") @ExperimentalCoroutinesApi -internal fun invokeHandlerMethod(method: Method, bean: Any, vararg args: Any?): Any? { +internal fun invokeSuspendingFunction(method: Method, bean: Any, vararg args: Any?): Any? { val function = method.kotlinFunction!! return if (function.isSuspend) { val mono = mono(Dispatchers.Unconfined) { diff --git a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHandlerMethod.java b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHandlerMethod.java index ea56427dd8f..0db41014e4f 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHandlerMethod.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/handler/invocation/reactive/InvocableHandlerMethod.java @@ -131,7 +131,7 @@ public class InvocableHandlerMethod extends HandlerMethod { Method method = getBridgedMethod(); ReflectionUtils.makeAccessible(method); if (KotlinDetector.isKotlinReflectPresent() && KotlinDetector.isKotlinType(method.getDeclaringClass())) { - value = CoroutinesUtils.invokeHandlerMethod(method, getBean(), args); + value = CoroutinesUtils.invokeSuspendingFunction(method, getBean(), args); } else { value = method.invoke(getBean(), args); diff --git a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java index 10e5ed430ea..ada5628945e 100644 --- a/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java +++ b/spring-webflux/src/main/java/org/springframework/web/reactive/result/method/InvocableHandlerMethod.java @@ -140,7 +140,7 @@ public class InvocableHandlerMethod extends HandlerMethod { ReflectionUtils.makeAccessible(getBridgedMethod()); Method method = getBridgedMethod(); if (KotlinDetector.isKotlinReflectPresent() && KotlinDetector.isKotlinType(method.getDeclaringClass())) { - value = CoroutinesUtils.invokeHandlerMethod(method, getBean(), args); + value = CoroutinesUtils.invokeSuspendingFunction(method, getBean(), args); } else { value = method.invoke(getBean(), args);