Is it recommended to use ThreadLocal to store the thread context?
I am creating a server application where there are standard services that I need to run.
Note. We are not building on the SOA architecture.
Before starting each service, I need to indicate the state in which there is Service Contex, which is a variable card for work. This map variable is shared when services are running in parallel.
Now, for example, the service needs to check the weather, it must be stopped or limited based on some flow-related parameters.
Question: This is a good approach to keep the context of the stream inside the stream local, and then create api through the service context to access the parameters for these variables.
This will help me hide complex behavior, and it will not reveal my inner things.
Thanks Aditya
Aditya
source share