In the simplest Spring (Boot) applications, I observe the following controller behavior, say
@CrossOrigin @RestController public class MyController { //... @RequestMapping(value = {"/lazy-dog"}) @ResponseBody public Rest lazyDog() { //... Thread.sleep(10000); // return Message("Dog exiting") } @RequestMapping(value = {"/quick-fox"}) @ResponseBody public Rest quickFox() { //... return Message("Fox exiting") } }
namely, simultaneous writing to lazyDog() not allowed (calling twice from two browser tabs lasts 20sec ), while simultaneous execution of lazyDog() and quickFox() allowed (as the dog waits, the fox can quickly execute, say , in a separate browser tab).
What needs to be done to simultaneously make two or more lazyDog() calls?
Note. I am currently running the application through:
@SpringBootApplication public class Application extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Application.class); } public static void main(String[] args) { SpringApplication.run(Application.class, args); } }
source share