File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Thread safety and cookie age question...

 
Amitkumar Dhama
Ranch Hand
Posts: 56
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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�
 
Charith Fernando
Ranch Hand
Posts: 67
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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...
 
Christophe Verré
Sheriff
Pie
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moreover, setting the cookie age to a negative value will cause it to be deleted when the web browser exits (specs, setMaxAge)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic