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

Application variables

 
Gaelle SMITS
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello !
I would like to know : what exactly can I store in the application object ? (using application.setAttribute, for example)
I have a Vector that is used by any user of my intranet site, can I store it in the application object so that anyone can access it ?
Then : how long does such an application variable live ? Is it persistent ?
Thanks !
Gaelle.
 
Andy Bowes
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you set application attributes they will be available until the application server is shutdown or until they are explicitly removed.
They are NOT persistent i.e. they will not be there if the server is shutdown and restarted. I would advise caution when using them however as you need to take issues like server clustering and they could potentially take up large amounts of memeory.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic