Skip to content

Instantly share code, notes, and snippets.

@toby55kij
Created August 21, 2023 09:42
Show Gist options
  • Save toby55kij/ae29479ea61dbf9110fc3c656dea54a4 to your computer and use it in GitHub Desktop.
Save toby55kij/ae29479ea61dbf9110fc3c656dea54a4 to your computer and use it in GitHub Desktop.
ブロッキング処理を呼び出す例3
private static final Schedulers SCHEDULER =
Schedulers.newBoundedElastic(Schedulers.DEFAULT_BOUNDED_ELASTIC_SIZE,
Schedulers.DEFAULT_BOUNDED_ELASTIC_QUEUESIZE,
"my-boundedElestic", 60, true);
@GetMapping("/foo/{id}")
public Mono<ReturnValue> get(ServerWebeExchange exchange, @PathVariable Long id) {
return Mono.fromCallable(() -> {
return getValue(id);
}).subscribeOn(SCHEDULER);
}
ReturnValue getValue(long id) {
// ブロッキング処理
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment