Question

I have a bean stored in session that bean provides some functionality. In order to make the functionality provided by the bean thread safe we should develop the bean in thread safe manner or session access to this bean should be made thread safe?

Was it helpful?

Solution

If the object itself is thread-safe, you can have 100 places in the code where you access this object, and it will be thread-safe every time.

If the object isn't thread-safe, you'll have to make sure that every one of the 100 places where you access the bean does it in a common way that guarantees the thread-safety.

I'd make the object thread-safe.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top