am trying to test the clustering of List objects. So, I declared a List object as a shared root in my class and is trying to add some objects to the ArrayList. But, I get the following exception inspite of declaring a named write lock on add() method (or infact all the methods) of ArrayList....
Exception in thread "main" com.tc.object.tx.UnlockedSharedObjectException: Thread [main] has attempted to access a shared object (an instance of java.util.ArrayList) without first getting a shared lock. Please specifiy a lock for this access via your Terracotta configuration
at com.tc.object.tx.ClientTransactionManagerImpl.getTransaction(ClientTransactionManagerImpl.java:185)
at com.tc.object.tx.ClientTransactionManagerImpl.logicalInvoke(ClientTransactionManagerImpl.java:465)
at com.tc.object.TCObjectImpl.logicalInvoke(TCObjectImpl.java:261)
at com.tc.object.bytecode.ManagerImpl.logicalInvoke(ManagerImpl.java:390)
at com.tc.object.bytecode.ManagerUtil.logicalInvoke(ManagerUtil.java:70)
at java.util.ArrayList.add(ArrayList.java)
would this be because of TC using its own ArrayList as part of its instrumented classes???
Please help on what is causing this...
Yes, the Java util classes are special cases that cannot be named locked. Instead of placing the write lock on the actual add method of the java.util.ArrayList class, put the lock on the methods that are calling the add().
Bill
_________________
Bill Chever
Product Support Manager
Terracotta, Inc.