ray/java/api
Qing Wang 2c3be852ab
[Java] Support defining ConcurrencyGroup statically in Java. (#20373)
This PR introduces statically defining ConcurrencyGroup APIs in Java.
We introduce 2 APIs:
1. Introducing `@DefConcurrencyGroup` annotation for an actor class to define a concurrency group statically.
2. Introducing `@UseConcurrencyGroup` annotation for actor methods to define the concurrency group to be used in the method.

Examples are below:

```java
 @DefConcurrencyGroup(name = "io", maxConcurrency = 2)
  @DefConcurrencyGroup(name = "compute", maxConcurrency = 4)
  private static class MyActor {
    @UseConcurrencyGroup(name = "io")
    public long f1() { }

    @UseConcurrencyGroup(name = "io")
    public long f2() { }

    @UseConcurrencyGroup(name = "compute")
    public long f3(int a, int b) { }

    @UseConcurrencyGroup(name = "compute")
    public long f4() { }
  }

ActorHandle<> myActor = Ray.actor(MyActor::new).remote();
myActor.task(MyActor::f1).remote();
myActor.task(MyActor::f2).remote();
myActor.task(MyActor::f3).remote();
myActor.task(MyActor::f4).remote();
```
`MyActor` has 3 concurrency groups: `io` with 2 concurrency, `compute` with 4 concurrency and `default` with 1 concurrency.
f1 and f2 will be executed in `io`, f3 and f4 will be executed in `compute`.
2022-01-17 16:23:10 +08:00
..
src/main/java/io/ray/api [Java] Support defining ConcurrencyGroup statically in Java. (#20373) 2022-01-17 16:23:10 +08:00
pom_template.xml Bump Java version to 2.0.0-SNAPSHOT (#15394) 2021-08-30 12:25:30 +08:00