Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-3077

cache.lock should work within the scope of batching

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 5.3.0.Beta2, 5.3.0.Final
    • 5.2.6.Final
    • None
    • None
    • Hide

      Instead of using cache.getAdvancedCache().startBatch()/endBatch() use:
      cache.getAdvancedCache().getTransactionManager().begin()/
      cache.getAdvancedCache().getTransactionManager().commit()

      Show
      Instead of using cache.getAdvancedCache().startBatch()/endBatch() use: cache.getAdvancedCache().getTransactionManager().begin()/ cache.getAdvancedCache().getTransactionManager().commit()

    Description

      cache.getAdvancedCache().startBatch();
      cache.lock("k");
      ...
      cache.endBatch(..);
      

      The code above throws an exception:

      java.lang.IllegalArgumentException: Cannot create a transactional context without a valid Transaction instance.
      at org.infinispan.context.TransactionalInvocationContextContainer.createInvocationContext(TransactionalInvocationContextContainer.java:113)
      at org.infinispan.context.TransactionalInvocationContextContainer.createInvocationContext(TransactionalInvocationContextContainer.java:108)
      at org.infinispan.CacheImpl.getInvocationContextForWrite(CacheImpl.java:471)
      at org.infinispan.CacheImpl.lock(CacheImpl.java:568)
      at org.infinispan.CacheImpl.lock(CacheImpl.java:553)
      at org.infinispan.api.batch.LockInBatchTest.testLockWithBatching(LockInBatchTest.java:47)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)
      at org.testng.internal.Invoker.invokeMethod(Invoker.java:714)
      at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:901)
      at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1231)
      at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:127)
      at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:111)
      at org.testng.TestRunner.privateRun(TestRunner.java:767)
      at org.testng.TestRunner.run(TestRunner.java:617)
      at org.testng.SuiteRunner.runTest(SuiteRunner.java:334)
      at org.testng.SuiteRunner.access$000(SuiteRunner.java:37)
      at org.testng.SuiteRunner$SuiteWorker.run(SuiteRunner.java:368)
      at org.testng.internal.thread.ThreadUtil$2.call(ThreadUtil.java:64)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:680)

      This logic should be supported, as batching is a convenient way for using transactions without the burden of configuring a transaction manager.

      Attachments

        Activity

          People

            mircea.markus Mircea Markus (Inactive)
            mircea.markus Mircea Markus (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: