1 22 package org.jboss.test.tm.test; 23 24 import javax.transaction.Transaction ; 25 26 32 public class SimpleNoLockTransactionLocalStressTestCase extends AbstractTransactionLocalStressTest 33 { 34 public void testSimpleTransactionLocalStressTestcase() throws Throwable 35 { 36 tm.setTransactionTimeout(0); 37 tm.begin(); 38 final Transaction tx = tm.suspend(); 39 SimpleTransactionLocalRunnable[] runnables = new SimpleTransactionLocalRunnable[getThreadCount()]; 40 for (int i = 0; i < runnables.length; ++i) 41 runnables[i] = new SimpleTransactionLocalRunnable(tx); 42 43 runConcurrentTest(runnables, new ConcurrentTestCallback() 44 { 45 public void finished() throws Throwable 46 { 47 tm.resume(tx); 48 tm.commit(); 49 } 50 }); 51 } 52 53 public class SimpleTransactionLocalRunnable extends ConcurrentTransactionLocalRunnable 54 { 55 public SimpleTransactionLocalRunnable(Transaction tx) 56 { 57 super(tx); 58 } 59 60 public void doRun() 61 { 62 try 63 { 64 local.set(this); 65 local.get(); 66 } 67 catch (Throwable t) 68 { 69 failure = t; 70 } 71 } 72 } 73 74 public SimpleNoLockTransactionLocalStressTestCase(String name) 75 { 76 super(name); 77 } 78 } 79 | Popular Tags |