Package runner

Source Code of runner.Runner

package runner;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

import thread.Transfert;

import bank.Bank;
import bank.NotSynchronizedBank;
import bank.synch.block.BlockLockSynchronizedBankWithCondition;
import bank.synch.explicit.ExplicitLockSynchronizedBank;
import bank.synch.explicit.ExplicitLockSynchronizedBankWithCondition;
import bank.synch.implicit.ImplicitLockSynchronizedBank;
import bank.synch.implicit.ImplicitLockSynchronizedBankWithCondition;

public class Runner {

  /**
   * @param args
   */
  public static void main(String[] args)
  {
    int accountsCount = 3;
    ExecutorService service = Executors.newFixedThreadPool(accountsCount);
//    Bank bank = new NotSynchronizedBank(1000, accountsCount);
//    Bank bank = new ExplicitLockSynchronizedBank(1000, accountsCount);
//    Bank bank = new ImplicitLockSynchronizedBank(1000, accountsCount);
//    Bank bank = new ExplicitLockSynchronizedBankWithCondition(1000, accountsCount);
    Bank bank = new ImplicitLockSynchronizedBankWithCondition(1000, accountsCount);
//    Bank bank = new BlockLockSynchronizedBankWithCondition(1000, accountsCount);
    while(--accountsCount>=0)
    {
      service.submit(new Transfert(bank, accountsCount));
    }
   
  }

}
TOP

Related Classes of runner.Runner

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.