1 22 package org.jboss.test.aop.bean; 23 24 import org.jboss.aspects.tx.Tx; 25 import org.jboss.aspects.txlock.TxSynchronized; 26 import org.jboss.aspects.tx.TxType; 27 28 32 public class AnnotatedTxLockedPOJO 33 { 34 35 public AnnotatedTxLockedPOJO() 36 { 37 field = 0; 38 } 39 40 private int field; 41 42 public int getField() { return field; } 43 44 @Tx (TxType.REQUIRED) 45 @TxSynchronized 46 public void setField(int val) 47 { 48 if (val == 6 && field == 0) 49 { 50 throw new RuntimeException ("TxLock didn't work. 2nd thread got there first."); 51 } 52 if (val == 5) 53 { 54 try { Thread.sleep(5000); } catch (Exception ignored) { } 56 } 57 field = val; 58 } 59 60 } 61 62 | Popular Tags |