FileDocCategorySizeDatePackage
JUnitTestReadWriteLockAspects.javaAPI DocJBoss 4.2.12388Fri Jul 13 21:02:22 BST 2007test.patterns.readwritelock

JUnitTestReadWriteLockAspects

public class JUnitTestReadWriteLockAspects extends TestCase
version
$Revision: 57186 $
author
{Claude Hussenet Independent Consultant}.

Fields Summary
Constructors Summary
public JUnitTestReadWriteLockAspects(String arg0)

		super(arg0);

	
Methods Summary
public static voidprocessReadWriteLockPattern(Account account)


	     new Thread(new ProcessTransaction(account,100)).start();
	     new Thread(new ProcessTransaction(account,300)).start();
	     new Thread(new ProcessTransaction(account,-150)).start();
	     new Thread(new ProcessTransaction(account,-250)).start();

	     try
	     {
			 Thread.sleep(500);
	     }
	     catch (Exception e)
	     {
	       System.out.println(e);
		 }
	   
public static voidtestProcessReadWriteLockPattern()


	Account accountWithoutReadWriteLock = new Account(1000);
	processReadWriteLockPattern(accountWithoutReadWriteLock);

    assertTrue("No Concurrent Issue without ReadWriteLock Aspect !",1000!=accountWithoutReadWriteLock.getBalance());
  	Account accountWithReadWriteLock = new AccountWithReadWriteLock(1000);
	processReadWriteLockPattern(accountWithReadWriteLock);
    assertTrue("Concurrent Issue with ReadWriteLock Aspect !",1000==accountWithReadWriteLock.getBalance());