[jboss-user] [JBossCache] - JBossCache 1.3 - CacheStoreInterceptor does not commit trans

archanaa_panda do-not-reply at jboss.com
Tue Mar 6 01:59:53 EST 2007


I am using JBossCache 1.3 SP4 with weblogic 8.1 SP4. JBossCache has been configured to use org.jboss.cache.GenericTransactionManagerLookup - so that the transaction Manager of weblogic would be used. I am also using a JDBC Cache Loader configuration

In my code, I have enclosed treeCache.put in a transaction i.e.

tx.begin();
  | treeCache.put(.....);
  | tx.commit();

What I observe is that even after commit(), records do not get inserted into database. This is causing a problem next time I try to insert any node on the same branch.

I did some debugging by checking the source code of the JBossCache. I find the following code in CacheStoreInterceptor.invoke() -


       if (log.isTraceEnabled()) {
  |            log.trace("CacheStoreInterceptor called with meth " + m);
  |        }
  | 
  |        if (tx_mgr != null && tx_mgr.getTransaction() != null) {
  |            // we have a tx running.
  |            log.trace("transactional so don't put stuff in the cloader yet.");
  |            GlobalTransaction gtx = getInvocationContext().getGlobalTransaction();
  |            if (TreeCache.commitMethod.equals(meth)) {
  |                if (getInvocationContext().isTxHasMods()) {
  |                    // this is a commit call.
  |                    if (log.isTraceEnabled()) log.trace("Calling loader.commit() for gtx " + gtx);
  |                    // sync call (a write) on the loader
  |                    List fqnsModified = getFqnsFromModificationList(tx_table.get(gtx).getModifications());
  |                    obtainLoaderLocks(fqnsModified);
  |                    try
  |                    {
  |                         loader.commit(gtx);
  |                    }
  |                    finally
  |                    {
  |                        releaseLoaderLocks(fqnsModified);
  |                        preparingTxs.remove(gtx);
  |                    }
  |                    if (cache.getUseInterceptorMbeans()&& statsEnabled) {
  |                       Integer puts = (Integer)m_txStores.get(gtx);
  |                       if (puts != null)
  |                          m_cacheStores = m_cacheStores + puts.intValue();
  |                       m_txStores.remove(gtx);
  |                    }
  |                }
  |                else {
  |                    log.trace("Commit called with no modifications; ignoring.");
  |                }
  |            }


I turned debug logging on and I observed that the following is printed

org.jboss.cache.interceptors.CacheStoreInterceptor CacheStoreInterceptor called with meth commit(GlobalTransaction:<127.0.0.1:2081>:1)

However, the next debug output was 

org.jboss.cache.interceptors.PessimisticLockInterceptor PessimisticLockInterceptor invoked for method commit(GlobalTransaction:<127.0.0.1:2081>:1)

Calling loader.commit()  was never printed!!!This means that the commit is not being called for the loader and the records are not getting stored into the database. This observation tallies with the results I am getting

Is this a known bug??? If so and if you are planning to fix the problem, I hope it is released in a future release of JBossCache 1.3 itself since I am not planning to upgrade to 1.4

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4025305#4025305

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4025305



More information about the jboss-user mailing list