Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
package com.example.mvc
import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController
import java.lang.Thread.sleep
import java.util.concurrent.CompletableFuture
import java.util.concurrent.ExecutorService
import java.util.concurrent.Executors
class Controller {
val worker = {
private val pool : ExecutorService = Executors.newFixedThreadPool(500)
fun asyncTest() : CompletableFuture<String> {
return CompletableFuture.supplyAsync(worker, pool::execute)
fun syncTest() : String {
return worker()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment