user3085390
user3085390

Reputation: 187

How to make session attribute threadsafe

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?

Upvotes: 1

Views: 266

Answers (1)

JB Nizet
JB Nizet

Reputation: 691755

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.

Upvotes: 2

Related Questions