| Author |
Thread safety and cookie age question...
|
Amitkumar Dhama
Ranch Hand
Joined: Feb 14, 2005
Posts: 56
|
|
hi all following is the explanation given for a question. servlet implementing SingletTreadModel. Three data elements are always thread-safe, they are: 1.Local variable 2.Request attribute 3.Session attribute For instance variables, they are NOT safe unless the servlet is a SingleThreadModel servlet, which means there is only one thread accessing one instance at one moment. For static/class variables, they are always NOT thread safe, even with SingleThreadModel marker. I got this explanation in iris mock, is it correct? coz, as far as I know session attributes are not thread safe� Help me out in clearing this one� and also please tell me if i'll set cookie age to -1 wgat will happen? Thanking in advance�
|
SCJP 1.4, SCWCD 1.4, M.Tech(CSE)
|
 |
Charith Fernando
Ranch Hand
Joined: Sep 12, 2005
Posts: 67
|
|
according to my knowledge i agree with u with the part where session variables are not thread safe.. the only thread safe variables are request attributes and local variables... for ur second problem relating to cookie age.. when u set it to -1 it lasts forever...
|
Charith I Fernando<br />SCJP5, SCWCD, SCBCD, BSc(Hons) IS<br />+94 773 263 222 (mobile)
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
|
Moreover, setting the cookie age to a negative value will cause it to be deleted when the web browser exits (specs, setMaxAge)
|
[My Blog]
All roads lead to JavaRanch
|
 |
 |
|
|
subject: Thread safety and cookie age question...
|
|
|