I have been having problems with my EE application and I believe I have discovered the root cause- static objects are available across all sessions of a tomcat webapp and do not die. I therefore need to adapt my code so that each session has unique object.
I have several classes which extend a Search. Search currently has
public static Parser parse;
as a field, and I refer to it through out my code.
Many of my other classes that extend search are created 50 times or so and I simply call super.getParse() whenever I need to use the Parser object. I want to avoid making a new one as it is a slow process.
What is the correct way to create a single Parser object and pass it around my code without it being static?
Really appreciate any advice or guidance.