简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM