I was working on a Java EE app that took in user requests from a UI and then keyed off a lon workflow asynchronously for each of these requests using ExecutorService (SinglethreadExecutor). Now since i was using a SinglethreadExecutor and because there was genuine need for the requests to be served one at a time, i did not feel the need for thread safety. Is my understanding correct ?
Recently i had asked a question Issue when executing asynchronous tasks using ExecutorService and the solution to this question was that i make my code thread safe. I'm looking if any shared resources that I'm using in my code is causing the need for this thread safety but would just like to be sure that my understanding of the scenario is correct.
FYI, I have implemented my ExecutorService
in a servlet as mentioned in Running a background Java program in Tomcat