Skip to content

Commit

Permalink
Virtual threads
Browse files Browse the repository at this point in the history
Signed-off-by: Eric Deandrea <[email protected]>
  • Loading branch information
edeandrea committed Nov 22, 2023
1 parent 130e098 commit 4702a91
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 8 deletions.
3 changes: 1 addition & 2 deletions grpc-locations/pom.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>io.quarkus.sample.super-heroes</groupId>
<artifactId>grpc-locations</artifactId>
Expand Down Expand Up @@ -157,7 +157,6 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<argLine>-Djdk.tracePinnedThreads</argLine>
<systemPropertyVariables>
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
<maven.home>${maven.home}</maven.home>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,17 @@ import io.quarkus.sample.superheroes.location.grpc.LocationsGrpc.LocationsImplBa
import io.quarkus.sample.superheroes.location.mapping.LocationMapper
import io.quarkus.sample.superheroes.location.service.LocationService
import io.smallrye.common.annotation.Blocking
import io.smallrye.common.annotation.RunOnVirtualThread

@GrpcService
class LocationGrpcService(private val locationService: LocationService) : LocationsImplBase() {
@Blocking
@RunOnVirtualThread
override fun getRandomLocation(request: RandomLocationRequest?, responseObserver: StreamObserver<Location>?) {
Log.debug("Requesting a random location")
returnLocationOrError(this.locationService.getRandomLocation(), responseObserver)
responseObserver?.onCompleted()
}

@Blocking
@RunOnVirtualThread
override fun getLocationByName(request: GetLocationRequest?, responseObserver: StreamObserver<Location>?) {
if (request != null) {
Log.debug("Getting location ${request.name}")
Expand All @@ -32,7 +29,6 @@ class LocationGrpcService(private val locationService: LocationService) : Locati
}

@Blocking
@RunOnVirtualThread
override fun replaceAllLocations(request: LocationsList?, responseObserver: StreamObserver<ReplaceAllLocationsResponse>?) {
if (request != null) {
Log.debug("Replacing all locations")
Expand All @@ -47,7 +43,6 @@ class LocationGrpcService(private val locationService: LocationService) : Locati
}

@Blocking
@RunOnVirtualThread
override fun getAllLocations(request: AllLocationsRequest?, responseObserver: StreamObserver<LocationsList>?) {
val allLocations = this.locationService.getAllLocations()
Log.debug("Got all locations: $allLocations")
Expand All @@ -60,7 +55,6 @@ class LocationGrpcService(private val locationService: LocationService) : Locati
}

@Blocking
@RunOnVirtualThread
override fun deleteAllLocations(request: DeleteAllLocationsRequest?, responseObserver: StreamObserver<DeleteAllLocationsResponse>?) {
Log.debug("Deleting all locations")

Expand Down

0 comments on commit 4702a91

Please sign in to comment.