[infinispan-dev] Re: lock within tx
Manik Surtani
manik at jboss.org
Mon May 11 05:17:10 EDT 2009
On 11 May 2009, at 06:55, Mircea Markus wrote:
> 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").
The data key should not be locked when you are adding a child. Now if
you tested this after NodeA.put(), then it should print "true".
Cheers
--
Manik Surtani
manik at jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org
More information about the infinispan-dev
mailing list