TxLockedPOJO.java |
/* * JBoss, the OpenSource J2EE webOS * * Distributable under LGPL license. * See terms of license at gnu.org. */ package org.jboss.test.aop.bean; /** * * @author <a href="mailto:bill@jboss.org">Bill Burke</a> * @version $Revision: 1.4 $ */ public class TxLockedPOJO { public TxLockedPOJO() { field = 0; } private int field; public int getField() { return field; } public void setField(int val) { if (val == 6 && field == 0) { throw new RuntimeException("TxLock didn't work. 2nd thread got there first."); } if (val == 5) { // Sleep to test the lock try { Thread.sleep(5000); } catch (Exception ignored) { } } field = val; } }
TxLockedPOJO.java |