6 Replies Latest reply on Sep 12, 2002 1:29 PM by dsundstrom

    question about locking-policy, MethodOnlyEJBLock

    fox_hk

      It seems that using org.jboss.ejb.plugins.lock.MethodOnlyEJBLock locking policy allows two threads associcated wtih
      two transactions to concurrently access the same entity bean . Am l correct ?
      It bring up a question in my mind, this locking-policy may introduce data consistency problem if two transactions calling some business
      methods such as setter methods of same entity bean. Transaction may read uncomitted changes made by other transaction or overwrite changes made
      by other transaction. Am l correct ?

      It is highly appreciated if some jboss guru can provide your insight into above question. Thanks a lot in advance.

      regards

      fox

        • 1. Re: question about locking-policy, MethodOnlyEJBLock
          dsundstrom

          My understanding of method only lock is it only assures that a single thread can access the bean instance at one time. This is different from the default transaction lock which assures that an bean can only be accessed in one transaction at a time (until the tx commits or rolls back).

          • 2. Re: question about locking-policy, MethodOnlyEJBLock
            dsundstrom

            I just taked with Bill Burke, and he says that you almost always use MethodOnlyLock with multi instance. With single instanc you effectivly get READ_UNCOMITTED.

            • 3. Re: question about locking-policy, MethodOnlyEJBLock
              fox_hk

              If commit-option B / C is used, will jboss strictly assign every transaction with its own instance of entity bean as same record is accessed. Will there be a chance that some transactions get its own instance of entity bean, some transactions "share" same instance of entity bean when same record is read/write.
              It is highly appreciated you can provide more information to me.

              regards
              fox

              • 4. Re: question about locking-policy, MethodOnlyEJBLock
                fox_hk

                If commit-option B / C is used, will jboss strictly assign every transaction with its own instance of entity bean as same record is accessed. Will there be a chance that some transactions get its own instance of entity bean, some transactions "share" same instance of entity bean when same record is read/write.
                It is highly appreciated you can provide more information to me.

                regards
                fox

                • 5. Re: question about locking-policy, MethodOnlyEJBLock
                  fox_hk

                  If commit-option B / C is used, will jboss strictly assign every transaction with its own instance of entity bean as same record is accessed. Will there be a chance that some transactions get its own instance of entity bean, some transactions "share" same instance of entity bean when same record is read/write.
                  It is highly appreciated you can provide more information to me.

                  regards
                  fox

                  • 6. Re: question about locking-policy, MethodOnlyEJBLock
                    dsundstrom

                    You just went way beyond my knowledge level on this. I suggest you ask on the jboss-users mailing list or the EJB/JBoss forum. Bill Burke is the guy that knows this stuff, and I know he reads the users list, but I don't know about the forum.