3 Replies Latest reply on Oct 5, 2004 9:29 AM by Alfred Lopez

    A Not Seen Use Case

    Alfred Lopez Newbie

      I've been searching the forums for this particular use-case. Please let me know if this is possible or if this is the inherent bahaviour of JBossCache.

      I'm a creating a web service using a Session Bean (using JBoss.NET). The session bean will have access to a TreeCacheAOP (btw: this is not JBoss 4.0). Will all instances of the Session Bean "share" the same cache? Do I *have* to place it in JNDI for to acquire this behaviour? Is this handled by the configuration file? I can implement it as an MBean but I just want my Session Bean (and all its instances) exclusive access to this cache.

      Thank you.

        • 1. Re: A Not Seen Use Case
          Ben Wang Master

          IMO, if you are running under JBoss, then MBean makes sense. Yes, they will share the same cache instance.


          • 2. Re: A Not Seen Use Case
            Norbert von Truchsess Newbie

            If you are _not_ deploying the cache as MBean but instantiate it from your own code (using the constructor and PropertyConfigurator) each instance will connect to the same Group sharing the same data, but will not be the same cache instance. (As a consequence the data would reside in memory multiple times).

            To use a single cache-instance (without using the MBean deploment) you have to write your own factory-class implementing a static factory-method that allways returns a reference to the same TreeCache-instance. (Or instantiate a single TreeCache-instance from some startup-class that binds the TreeCache to JNDI so every session-bean might retrive the same instance (in a single VM) from there.

            • 3. Re: A Not Seen Use Case
              Alfred Lopez Newbie

              Thanks for the replies. This helps make a decision. In the case of using JNDI, is the JNDI code in JBossCache (that I keep reading about) working at the moment? Thanks again.