tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tom ly <booshleeka...@yahoo.com>
Subject RE: how can I change a variable on the fly with shutting down tomcat
Date Thu, 29 Jan 2004 05:42:19 GMT
I don't have to write to a file, as long as I find a way to persistently store the changes
and make sure they take effect after a restart.  How would I be able to change the static
variable on the fly, say through a command line in unix?

"Shapira, Yoav" <Yoav.Shapira@mpi.com> wrote:
Howdy,

>afterwards. What can I do? I've though about using a text file. But I
>want to read from this text file once only during startup of tomcat,
store
>the value in memory for fast access but then be able to change the
value in
>memory as well as the text file on the fly. What can i use to do this?
or
>is there a better way?

There are many ways ;) Do you HAVE to write out to the file, or can you
just change the value in memory?

Typically when you want to do something once on startup you do it in a
ServletContextListener. Make the variable static and add static
accessors for your variable in your context listener implementation.
You can specify the configuration file location in web.xml as a
context-param, or you can specify the starting variable value itself if
you don't need a text file. If you are using a text file and want to
write out the final value when your app/server is shutting down, you can
do so in the contextDestroyed method of the listener.

Yoav Shapira



This e-mail, including any attachments, is a confidential business communication, and may
contain information that is confidential, proprietary and/or privileged. This e-mail is intended
only for the individual(s) to whom it is addressed, and may not be saved, copied, printed,
disclosed or used by anyone else. If you are not the(an) intended recipient, please immediately
delete this e-mail from your computer system and notify the sender. Thank you.


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org



---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message