It's not a secret anymore!
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Session Attributes - thread safe ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Session Attributes - thread safe ?" Watch "Session Attributes - thread safe ?" New topic
Author

Session Attributes - thread safe ?

Tuna Töre
Ranch Hand

Joined: Aug 17, 2008
Posts: 220

Hi This is my first post in SCWCD section....

I am reading HFSJ book and I am confused a little.

I would like to learn are session attributes thread safe?

In book the author says that they should be synchronized because the same client can send 2 same request with different browser windows at the same time ? is it true I know that when somebody open 2 window in the same browser you got 2 different session ? so how can it be ?

Thanks
[ December 01, 2008: Message edited by: Anut Walidera ]

blog: http://tunatore.wordpress.com

https://www.udemy.com/spring-framework-4-course-and-core-spring-certification/?couponCode=spring39coupon

Core Spring Certified Professional + SCJP 6.0 + SCWCD 1.5
Deepak Jain
Ranch Hand

Joined: Aug 05, 2006
Posts: 637
In book the author says that they should be synchronized because the same client can send 2 same request with different browser windows at the same time ? is it true I know that when somebody open 2 window in the same browser you got 2 different session ? so how can it be ?


IE: Press CTRL+N: This will open a new browser window but will maintain the same session.

Firefox: Press CTRL+TAB: This will open a new TAB but will maintain the same session.

Hence you need to synchcronize on session object before acessing or mutating session attributes.


SCJP, SCWCD, SCBCD
Tuna Töre
Ranch Hand

Joined: Aug 17, 2008
Posts: 220

Thanks I didn't know it before ....

I got it!!
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Session Attributes - thread safe ?
 
It's not a secret anymore!