GeeCON Prague 2014*
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


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: 219

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
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: 219

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

I got it!!
 
GeeCON Prague 2014
 
subject: Session Attributes - thread safe ?