Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

page 259. Session management

 
Arvind Mahendra
Ranch Hand
Posts: 1162
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the note at the bottom
"FYI- this wouldn't work correctly if the app is distributed on multiple JVMs, because there is no way to keep the static variables in sync. If the class is loaded on more than on JVM, each class will have its own value for the static counter variable"

If the variables were instance variables then would this work?
 
Abhishek Pratap
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think the same would be for instance variable. coz it talks abt each class on each JVM rather than migrating from one to another.

Also using instance variable will intialize it for 0 for each request.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic