-
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 RunOnVirtualThread annotations on beans implementing a JAX-RS…
… interface
- Loading branch information
1 parent
d34b810
commit 0552b70
Showing
8 changed files
with
178 additions
and
50 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
16 changes: 16 additions & 0 deletions
16
...eads/resteasy-reactive-virtual-threads/src/main/java/io/quarkus/virtual/rr/IResource.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,16 @@ | ||
package io.quarkus.virtual.rr; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.POST; | ||
import jakarta.ws.rs.Path; | ||
|
||
@Path("/itf") | ||
public interface IResource { | ||
|
||
@GET | ||
String testGet(); | ||
|
||
@POST | ||
String testPost(String body); | ||
|
||
} |
16 changes: 16 additions & 0 deletions
16
...steasy-reactive-virtual-threads/src/main/java/io/quarkus/virtual/rr/IResourceOnClass.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,16 @@ | ||
package io.quarkus.virtual.rr; | ||
|
||
import jakarta.ws.rs.GET; | ||
import jakarta.ws.rs.POST; | ||
import jakarta.ws.rs.Path; | ||
|
||
@Path("/itfOnClass") | ||
public interface IResourceOnClass { | ||
|
||
@GET | ||
String testGet(); | ||
|
||
@POST | ||
String testPost(String body); | ||
|
||
} |
29 changes: 29 additions & 0 deletions
29
...s/resteasy-reactive-virtual-threads/src/main/java/io/quarkus/virtual/rr/ResourceImpl.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,29 @@ | ||
package io.quarkus.virtual.rr; | ||
|
||
import jakarta.enterprise.context.RequestScoped; | ||
|
||
import io.quarkus.test.vertx.VirtualThreadsAssertions; | ||
import io.smallrye.common.annotation.RunOnVirtualThread; | ||
|
||
@RequestScoped | ||
public class ResourceImpl implements IResource { | ||
|
||
private final Counter counter; | ||
|
||
ResourceImpl(Counter counter) { | ||
this.counter = counter; | ||
} | ||
|
||
@RunOnVirtualThread | ||
public String testGet() { | ||
VirtualThreadsAssertions.assertEverything(); | ||
return "hello-" + counter.increment(); | ||
} | ||
|
||
@RunOnVirtualThread | ||
public String testPost(String body) { | ||
VirtualThreadsAssertions.assertEverything(); | ||
return body + "-" + counter.increment(); | ||
} | ||
|
||
} |
28 changes: 28 additions & 0 deletions
28
...asy-reactive-virtual-threads/src/main/java/io/quarkus/virtual/rr/ResourceOnClassImpl.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,28 @@ | ||
package io.quarkus.virtual.rr; | ||
|
||
import jakarta.enterprise.context.RequestScoped; | ||
|
||
import io.quarkus.test.vertx.VirtualThreadsAssertions; | ||
import io.smallrye.common.annotation.RunOnVirtualThread; | ||
|
||
@RequestScoped | ||
@RunOnVirtualThread | ||
public class ResourceOnClassImpl implements IResourceOnClass { | ||
|
||
private final Counter counter; | ||
|
||
ResourceOnClassImpl(Counter counter) { | ||
this.counter = counter; | ||
} | ||
|
||
public String testGet() { | ||
VirtualThreadsAssertions.assertEverything(); | ||
return "hello-" + counter.increment(); | ||
} | ||
|
||
public String testPost(String body) { | ||
VirtualThreadsAssertions.assertEverything(); | ||
return body + "-" + counter.increment(); | ||
} | ||
|
||
} |
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