3 Replies Latest reply on Dec 10, 2008 9:16 AM by Mark Little

    how to add custom ObjectStore

    mazz Master

      I see https://jira.jboss.org/jira/browse/JBTM-420 has added a new VolatileStore.

      Looking at the code, I see in order for you to add that new store impl, you had to modified a Java class Implementations:

      Inventory.inventory().addToList(new VolatileStoreSetup());


      Question: what if I wrote my own ObjectStore implementation (or, as another example, I want to take your VolatileStore code, build it myself and deploy it in JBossAS 4.2.1 :) - how can I do this?

      I see in the JBossTM docs at: http://www.redhat.com/docs/en-US/JBoss_Enterprise_Application_Platform/4.2.0.cp05/html/JBoss_TS_Programmers_Guide/apa.html it says:

      The default object store implementation can be overridden at runtime by setting the com.arjuna.ats.arjuna.objectstore.objectStoreType property variable to one of the types described below.


      But that property value doesn't look to be a class name - its something like "CacheStore" or "ShadowNoFileLockStore". That tells me there is no way to hook into a custom object store via a configuration file setting in jbossjta-properties.xml (JBossTM is running inside JBossAS in my example). Am I missing something?



        • 1. Re: how to add custom ObjectStore
          Jonathan Halliday Master

          There are a handful of spare names predefined for this purpose - you use one of them e.g.

          public ClassName className() {
          return ArjunaNames.Implementation_ObjectStore_UserDef0Store();
          }

          then use name="com.arjuna.ats.arjuna.coordinator.actionStore" value="UserDef0Store" in the config file.

          As for the registration, it's not required to put that in the Implementations class, you can do it via

          com.arjuna.ats.arjuna.gandiva.inventory.Inventory.inventory().addToList(new MyStoreSetup());

          provided you make that call before doing anything else transaction related. The config file is loaded on demand the first time the transaction manager is used and at that point tries to resolve the store name. If the inventory does not have an entry for it by then, bad things will happen.

          P.S. Don't use the VolatileStore in production.

          • 2. Re: how to add custom ObjectStore
            mazz Master

             

            "jhalliday" wrote:
            provided you make that call before doing anything else transaction related. The config file is loaded on demand the first time the transaction manager is used and at that point tries to resolve the store name.


            Note: In the JBossAS integration use-case, the Transaction Manager is started VERY early in the boot sequence. Therefore, I think it would be necessary to deploy a special MBean (-service.xml) that executes that code to add to the inventory list in its start method, and then you have to modify the Transaction Manager MBean deployment so it "depends" on this new MBean service.

            • 3. Re: how to add custom ObjectStore
              Mark Little Master

              Why do you want to add a custom ObjectStore?