title: Sharing a class instance between all users with Tomcat
body: <p>I have a class, called counter. It looks like this:</p>
  
  <pre><code>public class Counter {
    private int count;
  
    public Counter() {
      count = 1;
    }
  
    public int getCount(){
      return count;
    }
  
    public void incrementCount(){
      count++;
    }
  </code></pre>
  
  <p>I want to share a single instance of this between every user of a tomcat application.
  So user 1 and user 2 would both see getCount() as the same value.
  Assume for this that there is a technical reason why I can't store and read from a database.</p>
  
  <p>Any advice?</p>
  
  <p>Thanks.</p>