I would like to undarstand how tomcat and spring boot manage simuntenously requests on the same...
I would like to undarstand how tomcat and spring boot manage simuntenously requests on the same endpoint.
@RestController
public class SimpleRest {
private static long counter;
Random random = new Random();
@GetMapping("/counter")
long restCounter() {
try {
Thread.sleep(random.nextInt(1000));
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
incrementCounter();
System.out.println("Thread name : " + Thread.currentThread().getName());
return getCounter();
}
public void incrementCounter() {
for(long i =...