-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support Kotlin suspend functions as scheduler methods
- Loading branch information
Showing
38 changed files
with
514 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-scheduler-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>quarkus-scheduler-api</artifactId> | ||
<name>Quarkus - Scheduler - API</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-arc</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-vertx</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<parent> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-scheduler-parent</artifactId> | ||
<version>999-SNAPSHOT</version> | ||
</parent> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<artifactId>quarkus-scheduler-common</artifactId> | ||
<name>Quarkus - Scheduler - Common</name> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>io.quarkus</groupId> | ||
<artifactId>quarkus-scheduler-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.cronutils</groupId> | ||
<artifactId>cron-utils</artifactId> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.glassfish</groupId> | ||
<artifactId>javax.el</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
</dependencies> | ||
</project> |
2 changes: 1 addition & 1 deletion
2
...kus/scheduler/runtime/DefaultInvoker.java → ...eduler/common/runtime/DefaultInvoker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...us/scheduler/runtime/DelegateInvoker.java → ...duler/common/runtime/DelegateInvoker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/scheduler/runtime/ScheduledInvoker.java → ...uler/common/runtime/ScheduledInvoker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...s/scheduler/runtime/SchedulerContext.java → ...uler/common/runtime/SchedulerContext.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ntime/SkipConcurrentExecutionInvoker.java → ...ntime/SkipConcurrentExecutionInvoker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...heduler/runtime/SkipPredicateInvoker.java → .../common/runtime/SkipPredicateInvoker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...heduler/runtime/StatusEmitterInvoker.java → .../common/runtime/StatusEmitterInvoker.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...cheduler/runtime/util/SchedulerUtils.java → ...r/common/runtime/util/SchedulerUtils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...nsions/scheduler/deployment/src/main/java/io/quarkus/scheduler/deployment/KotlinUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.quarkus.scheduler.deployment; | ||
|
||
import org.jboss.jandex.MethodInfo; | ||
import org.jboss.jandex.Type; | ||
|
||
final class KotlinUtil { | ||
|
||
private static final Type VOID_CLASS = Type.create(SchedulerDotNames.VOID, Type.Kind.CLASS); | ||
|
||
private KotlinUtil() { | ||
} | ||
|
||
static boolean isSuspendMethod(MethodInfo methodInfo) { | ||
if (!methodInfo.parameters().isEmpty()) { | ||
return methodInfo.parameters().get(methodInfo.parameters().size() - 1).name() | ||
.equals(SchedulerDotNames.CONTINUATION); | ||
} | ||
return false; | ||
} | ||
|
||
static Type determineReturnTypeOfSuspendMethod(MethodInfo methodInfo) { | ||
Type lastParamType = methodInfo.parameters().get(methodInfo.parameters().size() - 1); | ||
if (lastParamType.kind() != Type.Kind.PARAMETERIZED_TYPE) { | ||
throw new IllegalStateException("Something went wrong during parameter type resolution - expected " | ||
+ lastParamType + " to be a Continuation with a generic type"); | ||
} | ||
lastParamType = lastParamType.asParameterizedType().arguments().get(0); | ||
if (lastParamType.kind() != Type.Kind.WILDCARD_TYPE) { | ||
throw new IllegalStateException("Something went wrong during parameter type resolution - expected " | ||
+ lastParamType + " to be a Continuation with a generic type"); | ||
} | ||
lastParamType = lastParamType.asWildcardType().superBound(); | ||
if (lastParamType.name().equals(SchedulerDotNames.KOTLIN_UNIT)) { | ||
return VOID_CLASS; | ||
} | ||
return lastParamType; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.