+ public static abstract class PrevalentServlet extends HttpServlet {
+ protected Hashtable prevalent;
+ protected Prevayler prevayler;
+ protected ServletContext cx = null;
+ public void destroy() { try {
+ synchronized(this.getClass()) {
+ Prevayler privatePrevayler = prevayler;
+ if (prevayler == null) return;
+ prevayler = null;
+ Prevalence.destroy(cx, prevayler);
+ }
+ } catch (Exception e) { e.printStackTrace(); } }
+
+ public void init(ServletConfig sc) throws ServletException {
+ cx = sc.getServletContext();
+ prevayler = Prevalence.getPrevayler(cx);
+ prevalent = (Hashtable)prevayler.prevalentSystem();
+ }
+ }
+