4 Replies Latest reply on Nov 2, 2009 4:22 AM by adam.laczynski

    JBoss cache / WebLogic: problem with suspend/resume transact

    adam.laczynski

      I used JBoss Cache with WebLogic. I noticed that org.jboss.cache.interceptors.InvocationContextInterceptor suspend/resume xa transaction. It causes problem on WebLogic when iteration thought ResultSet is not finished.
      I posted it on oracle forum but without any solution (http://forums.oracle.com/forums/thread.jspa?threadID=975115).
      I have two questions:
      1) Why JBoss Cache suspend/resume transaction? Could it be disabled?
      2) Do anybody have similar problem? How it was solved?

      My environment
      - JBoss Cache (3.1.0.GA)
      - WebLogic 10.0.2.0
      - Oracle thin driver 10.2.0.2.0

      Best regards[/url]

        • 1. Re: JBoss cache / WebLogic: problem with suspend/resume tran
          brian.stansberry

          JBoss Cache doesn't suspend/resume the transaction; it's Hibernate's integration with JBC that does this. If JBC sees an active transaction it will hold a lock on data in the cache until that tx commits. There are times when it's incorrect for those locks to be held for that long, so Hibernate suspends the tx before calling into JBC.

          To avoid these suspensions you should:

          1) Not use query caching, since the suspensions are very common with query caching operations.

          2) Avoid bulk operations (executing SQL or HQL that modifies multiple entities) since that results in cache-clearing operations that involve suspending any active tx.

          3) For the same reason, avoid the org.hibernate.SessionFactory evict* methods and the org.hibernate.Cache evict* methods.

          • 2. Re: JBoss cache / WebLogic: problem with suspend/resume tran
            adam.laczynski

             

            "bstansberry@jboss.com" wrote:
            JBoss Cache doesn't suspend/resume the transaction; it's Hibernate's integration with JBC that does this. If JBC sees an active transaction it will hold a lock on data in the cache until that tx commits. There are times when it's incorrect for those locks to be held for that long, so Hibernate suspends the tx before calling into JBC.

            Suspend/resume is invoked from org.jboss.cache.interceptors.InvocationContextInterceptor#handleAll while optionOverride.isFailSilently() returns true. It comes from org.jboss.cache.invocation.CacheInvocationDelegate#putForExternalRead.

            Maybe you meant that suspent/resume is invoked by Hibernate which invoked JBC methods with appropriate parameters.

            As regards your suggestions:
            1) I don't use query cache
            2) Problem occures in read only transaction
            3) Any evict on org.hibernate.SesssionFactory and org.hibernate.cache.CacheConcurrencyStrategy

            • 3. Re: JBoss cache / WebLogic: problem with suspend/resume tran
              brian.stansberry

              Ah, you're right; JBC internally implements putForExternalRead with a tx suspend, because the semantic of that operation is to not hold locks beyond the scope of the method call.

              Sorry, I don't see any workaround to this problem. The putForExternalRead call is fundamental to how Hibernate stores data read from the db in the cache. :(

              • 4. Re: JBoss cache / WebLogic: problem with suspend/resume tran
                adam.laczynski

                Thank you for answer.