p.setName("Ben");
Address add = new Address();
add.setCity("Taipei");
p.setAddress(add);
List lang = new ArrayList();
IdObject id1 = new IdObject("1");
lang.add(id1);
p.setLanguages(lang);
cache_.putObject("/test/ben", p);
Thread t1 = new Thread()
{
Transaction tx;
public void run()
{
UserTransaction tx = null;
List lang = null;
IdObject id2 = new IdObject("2");
IdObject id3 = new IdObject("3");
try {
Person ben = (Person)cache_.getObject("/test/ben");
lang = ben.getLanguages();
tx = getTransaction();
tx.begin();
lang.add(id2);
lang.add(id3);
lang.remove(0);
TestingUtil.sleepThread(1000);
tx.commit();
}
catch(RollbackException rollback) {
try {
tx = getTransaction();
tx.begin();
lang.add(id2);
lang.add(id3);
lang.remove(0);
tx.commit();
} catch (Exception ex)
{
t1_ex = ex;
}
}
catch (Exception ex) {
t1_ex = ex;
}
}
};
Thread t2 = new Thread()
{
Transaction tx;
public void run()
{
List lang = null;
UserTransaction tx = null;
IdObject id1 = null;
try {
Person ben = (Person)cache1_.getObject("/test/ben");
lang = ben.getLanguages();
tx = getTransaction();
tx.begin();
id1 = new IdObject("2");
lang.add(id1);
TestingUtil.sleepThread(1000);
tx.commit();
}
catch(RollbackException rollback) {