[infinispan-dev] lock within tx

Mircea Markus mircea.markus at jboss.com
Mon May 11 01:55:34 EDT 2009


Hi Manik,

In the following modified version of NodeAPITest.testAddingDataTx, the 
output will be "false" (the version here is slightly modified).

   public void testAddingDataTx() throws Exception {
      Node<Object, Object> rootNode = cache.getRoot();
      tm.begin();
      Node<Object, Object> nodeA = rootNode.addChild(A);
      NodeKey dataKey = new NodeKey(Fqn.fromString("/a"), 
NodeKey.Type.DATA);
      System.out.println("is it locked???" + 
cache.getCache().getAdvancedCache().getInvocationContextContainer().get().hasLockedKey(dataKey));

      nodeA.put("key", "value");

      assertEquals("value", nodeA.get("key"));
      tm.commit();
   }

Now, after creating a node within a tx, shouldn't the corresponding 
dataKey have a WL? (i.e. the code to print "true").

Cheers,
Mircea




More information about the infinispan-dev mailing list