Using gRPC response of com.google.common.util.concurrent.ListenableFuture and calling get on it, is it blocking the thread that does the get() call?

Or because I'm inside a coroutine the thread is free and only resumed when the network response arrived?

Notice that I'm starting from a rest controller with suspend method.

Kotlin code calling to Java gRPC library:

@RestController
class SomeController(

  @GetMapping("/create-table")
  suspend fun createTable(@RequestBody request: CreateCDPTableRequest): CreateTableResponse {

val response: ListenableFuture<Response> = stub.some-grpc-call(requestBuilder.build())

return runInterruptible(Dispatchers.IO) {
       response.get()
      }
}
}

Is there a way to use it as non-blocking?

0

There are 0 best solutions below