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

Driver

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

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

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

	Account accountWithReadWriteLock = new AccountWithReadWriteLock(1000);
	testReadWriteLockPattern(accountWithReadWriteLock);

   
public static voidtestReadWriteLockPattern(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("The balance should be $1000 and it's "+account);