Examples of StatefulSessionHome


Examples of org.jboss.test.testbean.interfaces.StatefulSessionHome

      InitialContext ctx = new InitialContext(env1);
     
      getLog().debug("Test Stateful Bean Failover");
      getLog().debug("==================================");
      getLog().debug(++test+"- "+"Looking up the home nextgen.StatefulSession...");
      StatefulSessionHome  statefulSessionHome =
      (StatefulSessionHome) ctx.lookup("nextgen_StatefulSession");
      if (statefulSessionHome!= null ) getLog().debug("ok");
         getLog().debug(++test+"- "+"Calling create on StatefulSessionHome...");
      StatefulSession statefulSession =
      (StatefulSession)statefulSessionHome.create("Bupple-Dupple");
      assertTrue("statefulSessionHome.create() != null", statefulSession != null);
      getLog().debug("ok");
     
      NodeAnswer node1 = statefulSession.getNodeState ();
      getLog ().debug (node1);
View Full Code Here

Examples of org.jboss.test.testbean.interfaces.StatefulSessionHome

         "org.jnp.interfaces.NamingContextFactory");
      env1.setProperty(Context.PROVIDER_URL, urls[0]);
      InitialContext ctx = new InitialContext(env1);

      int beanCount = 500;
      StatefulSessionHome home =
         (StatefulSessionHome) ctx.lookup("nextgen_ExpiredStatefulSession");
      long start = System.currentTimeMillis();
      log.info("Start bean creation");
      StatefulSession[] beans = new StatefulSession[beanCount];
      long[] accessStamp = new long[beanCount];
      for(int n = 0; n < beans.length; n ++)
      {
         beans[n] = (StatefulSession) home.create("testStatefulPassivationExpiration#"+n);
         accessStamp[n] = System.currentTimeMillis();
      }
      long end = System.currentTimeMillis();
      log.info("End bean creation, elapsed="+(end - start));

      int N = 5000;
      long min = 99999, max = 0, maxInactive = 0;
      for(int n = 0; n < N; n ++)
      {
         int id = n % beans.length;
         StatefulSession bean = beans[id];
         if (bean == null)
            continue// bean timed out and removed
         String name = "testStatefulPassiviationExpiration#"+id;
         long callStart = System.currentTimeMillis();
         long inactive = callStart - accessStamp[id];
         try
         {
            bean.setName(name);
            NodeAnswer node = bean.getNodeState();
            long now = System.currentTimeMillis();           
            long elapsed = now - callStart;
            accessStamp[id] = now;
            assertTrue("NodeAnswer == "+name, node.answer.equals(name));
            min = Math.min(min, elapsed);
            max = Math.max(max, elapsed);
            maxInactive = Math.max(maxInactive, inactive);
            log.debug(n+", elapsed="+elapsed+", inactive="+inactive);
         }
         catch (java.rmi.NoSuchObjectException nso)
         {
            log.debug(n+" Caught NoSuchObjectException on bean " + id + " -- inactive time = " + inactive);
            // Remove the bean as it will never succeed again
            beans[id] = null;
         }
      }
      log.info(N+" calls complete, max="+max+", min="+min+", maxInactive="+maxInactive);

      Thread.sleep(15000);
      start = System.currentTimeMillis();
      for(int n = 0; n < beans.length; n ++)
      {
         beans[n] = (StatefulSession) home.create("testStatefulPassivationExpiration#"+n);
         accessStamp[n] = System.currentTimeMillis();
      }
      end = System.currentTimeMillis();
      log.info("End second round bean creation, elapsed="+(end - start));
      for(int n = 0; n < N; n ++)
View Full Code Here

Examples of org.jboss.test.txiiop.interfaces.StatefulSessionHome

      getLog().debug("Obtain home interface");
      // Create a new session object
      Context ctx  = getInitialContext();
      Object ref = ctx.lookup("txiiop/StatefulSessionBean");
      StatefulSessionHome home =
         (StatefulSessionHome) PortableRemoteObject.narrow(
                                               ref, StatefulSessionHome.class);
      StatefulSession bean = home.create("testUserTx");

      bean.setCounter(100);
      getLog().debug("Try to instantiate a UserTransaction");
      UserTransaction userTx = (UserTransaction)ctx.lookup("UserTransaction");
      userTx.begin();
View Full Code Here
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.