Keeping Information across restart of webapps

S

Steffen Schlachter

I want to track some information across multiple restarts of my
webapp.

The problem is as follows: Every time my service fails I want to
increase a counter. Sometime I need to restart my webapp but I want to
keep the values stored in the counter.

I am using Tomcat 5 and Servlets. Can anyone give me a hint?

Regards,

Steffen
 
S

Stefan Waldmann

Steffen said:
I want to track some information across multiple restarts of my
webapp.

The problem is as follows: Every time my service fails I want to
increase a counter. Sometime I need to restart my webapp but I want to
keep the values stored in the counter.

I am using Tomcat 5 and Servlets. Can anyone give me a hint?

Regards,

Steffen

Hi,

why don't you simply store the counter in a File? When your webapp
(re)starts, just read the file, do a counter++ and rewrite the file.

HTH. Greetings,
Stefan
 
J

Jeff Schwab

Steffen said:
I want to track some information across multiple restarts of my
webapp.

The problem is as follows: Every time my service fails I want to
increase a counter. Sometime I need to restart my webapp but I want to
keep the values stored in the counter.

I am using Tomcat 5 and Servlets. Can anyone give me a hint?

As Stefan suggested, storing the counter's value in a file is a
reasonable solution. You may find it easier to use the Preferences API
available as of Java 1.4.
 
A

Arvind

Other (not so straight forward) options include storing the counter in
a simple table and incrementing them on restarts as well
;)
Arvind
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,438
Messages
2,571,699
Members
48,796
Latest member
Greg L.
Top