1 22 package org.jboss.test.jca.test; 23 24 import javax.resource.cci.Connection ; 25 26 32 public class RecyclingStickyWithContinuousPoisonThreadStressTestCase extends AbstractRecyclingPoolingStressTest 33 { 34 public boolean isSticky() 35 { 36 return true; 37 } 38 39 public void testIt() throws Throwable 40 { 41 tm.setTransactionTimeout(0); 42 RecyclingPoolingRunnable[] runnables = new RecyclingPoolingRunnable[getThreadCount()]; 43 runnables[0] = new RecyclingPoolingRunnable() 44 { 45 public void doStart() throws Throwable 46 { 47 tm.begin(); 48 tm.setRollbackOnly(); 49 } 50 51 public void doRun() throws Throwable 52 { 53 doRun1(); 54 } 55 56 public void doEnd() throws Throwable 57 { 58 tm.rollback(); 59 } 60 61 public void doRun1() throws Throwable 62 { 63 boolean thrown = false; 64 try 65 { 66 cf.getConnection(); 67 } 68 catch (Throwable expected) 69 { 70 thrown = true; 71 } 72 if (thrown == false) 73 throw new Exception ("Expected exception for rolled back tx"); 74 } 75 }; 76 for (int i = 1; i < runnables.length; ++i) 77 { 78 runnables[i] = new RecyclingPoolingRunnable() 79 { 80 public void doRun1() throws Throwable 81 { 82 Connection c = cf.getConnection(); 83 c.close(); 84 } 85 }; 86 } 87 88 runConcurrentTest(runnables, null); 89 } 90 91 public RecyclingStickyWithContinuousPoisonThreadStressTestCase(String name) 92 { 93 super(name); 94 } 95 } 96 | Popular Tags |