I am working on spring project. I put Thread.sleep(60000)
on one api to check thread safety. If I call that api then all other apis wait for that time. I thought every api request processed by separate threads. So what is the reason behind this behaviour?
Asked
Active
Viewed 432 times
1
-
The bean in spring is singleton by default. I think this may be a problem. Add a `@RequestScope` to bean and check again. – staszek Nov 10 '16 at 10:39
-
1Spring doesn't. Tomcat does. There is no guarantee about the relationship between threads and requests. – user207421 Nov 10 '16 at 10:44
-
2@EJP I suppose this would have been solves with `http-thread-pool size` with glassfish, any similar option in tomcat ? Just asking, not an expert in this domain... – AxelH Nov 10 '16 at 11:44
-
How this relates Couchbase? – avsej Nov 10 '16 at 12:18
-
@AxelH thank you. The issue solved when I set thread-pool-size in tomcat. – navintb Nov 10 '16 at 12:26
-
@navintb So there is a thread pool in tomcat ^^. Here is a duplicate, this should answer your problem (confirm please) if not I will write an answer later. – AxelH Nov 10 '16 at 12:33
-
@AxelH Issue resolved when I set maxThreads in tomcat server.xml file. – navintb Nov 10 '16 at 12:37
-
@avsej I didn't know if this behaviour was related to spring, tomcat or couchbase. Thats why I included couchbase. – navintb Nov 10 '16 at 12:41
1 Answers
1
Issue resolved when I set maxThreads in tomcat server.xml file. Thank you all for helping me resolve this issue.

navintb
- 129
- 5