Package org.jboss.test.bankiiop.interfaces

Examples of org.jboss.test.bankiiop.interfaces.Teller


      throws Exception
   {
      TellerHome home = (TellerHome)PortableRemoteObject.narrow(
                             getInitialContext().lookup(TellerHome.JNDI_NAME),
                             TellerHome.class);
      Teller teller = home.create();
     
      BankHome bankHome = (BankHome)PortableRemoteObject.narrow(
                               getInitialContext().lookup(BankHome.JNDI_NAME),
                               BankHome.class);
      Bank bank = bankHome.create();
     
      getLog().debug("Acquire customers");
      Customer marc = teller.getCustomer("Marc");
      Customer rickard = teller.getCustomer("Rickard");
     
      getLog().debug("Acquire accounts");
      Account from = teller.getAccount(marc, 200);
      Account to = teller.getAccount(rickard, 200);
     
      getLog().debug("Show balance");
      getLog().debug(from.getPrimaryKey()+":"+from.getBalance());
      getLog().debug(to.getPrimaryKey()+":"+to.getBalance());

      getLog().debug("Transfer money");
     
      long start = System.currentTimeMillis();
      int iter = 10;
      for (int i = 0; i < iter; i++)
         teller.transfer(from, to, 50);
      long end = System.currentTimeMillis();
      getLog().info("Average call time: "+((end - start) / (iter*6)));
     
      getLog().debug("Show balance");
      AccountHome accountHome = (AccountHome)PortableRemoteObject.narrow(
                            getInitialContext().lookup(AccountHome.JNDI_NAME),
                            AccountHome.class);
      Collection accts = accountHome.findAll();
      Iterator i = accts.iterator();
      while(i.hasNext())
      {
         Account acct = (Account)PortableRemoteObject.narrow(i.next(),
                                                             Account.class);
         AccountData data = acct.getData();
         getLog().debug(data.getId()+"("+data.getOwner().getName()+"):"+data.getBalance());
         acct.withdraw(data.getBalance()); // Clear
      }
     
      teller.remove();
   }
View Full Code Here


      throws Exception
   {
      TellerHome home = (TellerHome)PortableRemoteObject.narrow(
                             getInitialContext().lookup(TellerHome.JNDI_NAME),
                             TellerHome.class);
      final Teller teller = home.create();
     
      getLog().debug("Acquire customers");
      Customer marc = teller.getCustomer("Marc");
      Customer rickard = teller.getCustomer("Rickard");
     
      getLog().debug("Acquire accounts");
      final Account from = teller.getAccount(marc, 50);
      final Account to = teller.getAccount(rickard, 0);
     
      final Object lock = new Object();
  
    
      iter = getThreadCount();
      final int iterationCount = getIterationCount();
      getLog().info("Start test. "+getThreadCount()+ " threads, "+getIterationCount()+" iterations");
      long start = System.currentTimeMillis();

      for (int i = 0; i < getThreadCount(); i++)
      {
         Thread.sleep(50);
         new Thread(new Runnable()
         {
            public void run()
            {
               Logger log = Logger.getLogger(getClass().getName());

               try
               {
                 
                  for (int j = 0; j < iterationCount; j++)
                  {
                     if (exc != null) break;
                    
                     teller.transfer(from,to,50);
                     teller.transfer(from,to,-50);
//                     Thread.currentThread().yield();
//                     logdebug(idx++);
                  }
               } catch (Exception e)
               {
View Full Code Here

      throws Exception
   {
      TellerHome home = (TellerHome)PortableRemoteObject.narrow(
                             getInitialContext().lookup(TellerHome.JNDI_NAME),
                             TellerHome.class);
      Teller teller = home.create();
     
      getLog().debug("Acquire customers");
      Customer marc = teller.getCustomer("Marc");
      getLog().debug("Marc acquired");
      Customer rickard = teller.getCustomer("Rickard");
      getLog().debug("Rickard acquired");
     
      getLog().debug("Acquire accounts");
      Account from = teller.getAccount(marc, 50);
      Account to = teller.getAccount(rickard, 0);
     
      getLog().debug("Show balance");
      getLog().debug(from.getPrimaryKey()+":"+from.getBalance());
      getLog().debug(to.getPrimaryKey()+":"+to.getBalance());

      getLog().debug("Transfer money");
      teller.transfer(from, to, 50);
      getLog().debug("Transfer done");
     
      getLog().debug("Show balance");
      getLog().debug(from.getPrimaryKey()+"("+from.getOwner().getName()+"):"+from.getBalance());
      getLog().debug(to.getPrimaryKey()+"("+to.getOwner().getName()+"):"+to.getBalance());
     
      teller.remove();
     
   }
View Full Code Here

   {
        
      TellerHome home = (TellerHome)PortableRemoteObject.narrow(
                             getInitialContext().lookup(TellerHome.JNDI_NAME),
                             TellerHome.class);
      Teller teller = home.create();
     
      getLog().debug("Acquire customers");
      Customer marc = teller.getCustomer("Marc");
      getLog().debug("Marc acquired");
      Customer rickard = teller.getCustomer("Rickard");
      getLog().debug("Rickard acquired");
     
      getLog().debug("Acquire accounts");
      Account from = teller.getAccount(marc, 50*getIterationCount());
      Account to = teller.getAccount(rickard, 0);
     
      getLog().debug("Show balance");
      getLog().debug(from.getPrimaryKey()+":"+from.getBalance());
      getLog().debug(to.getPrimaryKey()+":"+to.getBalance());

      getLog().info("Transfer money");
      long start = System.currentTimeMillis();
      teller.transferTest(from, to, 50, getIterationCount());
      long end = System.currentTimeMillis();
      getLog().info("Transfer done");
      getLog().info("Total time(ms):"+(end-start));
      getLog().info("Avg. time/call(ms):"+((end-start)/(getIterationCount()*2)));
     
      getLog().debug("Show balance");
      getLog().debug(from.getPrimaryKey()+":"+from.getBalance());
      getLog().debug(to.getPrimaryKey()+":"+to.getBalance());
     
      teller.remove();
   }
View Full Code Here

   {
        
      TellerHome home = (TellerHome)PortableRemoteObject.narrow(
                             getInitialContext().lookup(TellerHome.JNDI_NAME),
                             TellerHome.class);
      Teller teller = home.create();
     
      getLog().debug("Acquire customers");
      Customer marc = teller.getCustomer("Marc");
      getLog().debug("Marc acquired");
      Customer rickard = teller.getCustomer("Rickard");
      getLog().debug("Rickard acquired");
     
      getLog().debug("Acquire accounts");
      Account from = teller.getAccount(marc, 50*getIterationCount());
      Account to = teller.getAccount(rickard, 0);
     
      getLog().info("Do read calls");
      long start = System.currentTimeMillis();
      for (int i = 0; i < getIterationCount(); i++)
      {
         marc.getName();
         from.getBalance();
         rickard.getName();
         to.getBalance();
      }
      long end = System.currentTimeMillis();
     
      getLog().info("Calls done");
      getLog().info("Total time(ms):"+(end-start));
      getLog().info("Avg. time/call(ms):"+((end-start)/(getIterationCount()*4)));
     
      teller.remove();
   }
View Full Code Here

TOP

Related Classes of org.jboss.test.bankiiop.interfaces.Teller

Copyright © 2018 www.massapicom. 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.