1 Reply Latest reply on Nov 12, 2007 11:55 AM by Pete Muir

    Dealing with Application-scope thread-safe services like Luc

    Asgeir Frimannsson Newbie

      I'm just getting started with Seam (and Java EE in general) and have best-practices related question:

      In my application, in addition to Hibernate I'm using Lucene for indexing XML and a Berkley DB XML database for Xml Storage. These are both thread-safe, and I would like to keep instances of these available for my session beans to share/use whenever my application is running. (e.g a Lucene 'IndexSearcher' instance or a Berkley DB Xml 'XmlContainer'). I do not want to close and reopen the indexes/databases when my application is running, but rather open an instance when the application starts, and close when the server is shut down, and give the user some sort of error page when e.g. the XML db is not available.

      Ideally, I'm looking for something that enables me to write my session beans similar to how I would use e.g. the Logger or EntityManager, like:

      @In MySearchManager sm;
      @In MyXmlDbManager xdm;

      ...and use it similar to how e.g. EntityManager is used...

      Does anyone have some hints or tips on common practices for dealing with this?

      cheers,
      asgeir