title: Why use the ServletContext object in a web-app containing servlets and "worker" threads in Java
body: <p>I currently have a web-app where I have Servlets reading and writing to the <code>ServletContext</code> attributes and I have "working" Threads (Daemon threads) which get initialized on startup and currently hold as a member the <code>ServletContext</code> object.
  For a couple of reasons I'm thinking of moving to "implement <code>Runnable</code>" instead and I'm kind of stuck with the fact that I need a common resource that servlets and non-servlets can use to talk with each other and I feel I'm a bit stuck in the whole <code>ServletContext</code> paradigm.
  I'd appreciate it if someone could provide points on why to use the <code>ServletContext</code> (my way or another way) and also I'm thinking to just use a singleton class which will be initialized on startup and will be thread safe and I'll just route all communication of the servlets and non-servlets through it.
  What do you think?</p>
  
  <p>Thanks</p>