title: Tracking webservice usage in Java
body: <p>I am using a 3rd party (address validation) WebService in our application. The license to the WS includes only certain number of calls, exceeding which we pay more. I am trying to keep track of the usage within our application, so we can warn the users, before they exceed. Sort of like a hit counter for Web Services.</p>
  
  <p>I am currently using a Static variable in the (controller) class to track it. This works, but only until the server gets restarted, at which time it resets to 0 again. </p>
  
  <p>Is there a way to keep the counter running across restarts? I saw some suggestions about serializing static variable. Is this the right approach? Or should I read/write to a file/DB table every time I make the request (sounds costly).</p>
  
  <p>MY webservice client will be running in an old Sybase EAServer (built around Apache Tomcat). So, I can only use Java 1.4.</p>
  
  <p>Thanks for any comments or suggestions.</p>