Examples of VMID


Examples of com.starlight.intrepid.VMID


  public static <T> void dropToCaller( ID<T> id, T object, boolean compress )
    throws ChannelRejectedException, IOException {

    VMID vmid = IntrepidContext.getCallingVMID();
    Intrepid instance = IntrepidContext.getActiveInstance();

    if ( vmid != null && instance == null ) {
      throw new IllegalStateException(
        Resources.ERROR_DROP_WITH_VMID_BUT_NO_INSTANCE.getValue() );
View Full Code Here

Examples of java.rmi.dgc.VMID

      env1.setProperty(Context.PROVIDER_URL, jndiURLs[0]);
      env1.setProperty("jnp.disableDiscovery", "true");
      InitialContext ctx1 = new InitialContext(env1);
      VMTester tester1 = (VMTester) ctx1.lookup(TESTER_JNDI_NAME);
     
      VMID create1 = tester1.getCreatorVMID();
      // confirm that the bean didn't have to migrate
      assertEquals("bean targeted where created", create1, tester1.getVMID());
     
      // Get another bean from the same server; should target
      // a different server from the first
      VMTester tester2 = (VMTester) ctx1.lookup(TESTER_JNDI_NAME);
     
      VMID create2 = tester2.getCreatorVMID();
      assertEquals("2nd bean targeted where created", create2, tester2.getVMID());     
      assertFalse("creation of 2 beans load balanced", create1.equals(create2));
     
      // A third bean should come from the same as the first
      VMTester tester3 = (VMTester) ctx1.lookup(TESTER_JNDI_NAME);
     
      VMID create3 = tester3.getCreatorVMID();
      assertEquals("3rd bean targeted where created", create3, tester3.getVMID());
      assertEquals("creation of 3 beans load balanced", create1, create3);
     
      // Get the next proxy from the other server, but the overall
      // bean creation should still be round robin
     
      Properties env2 = new Properties();
      env2.setProperty(Context.PROVIDER_URL, jndiURLs[1]);
      env2.setProperty("jnp.disableDiscovery", "true");
      InitialContext ctx2 = new InitialContext(env2);
      VMTester tester4 = (VMTester) ctx2.lookup(TESTER_JNDI_NAME);
     
      VMID create4 = tester4.getCreatorVMID();
      assertEquals("4th bean targeted where created", create4, tester4.getVMID());
      assertEquals("creation of 4 beans load balanced", create2, create4);
     
      // One last time
      VMTester tester5 = (VMTester) ctx2.lookup(TESTER_JNDI_NAME);
     
      VMID create5 = tester5.getCreatorVMID();
      assertEquals("5th bean targeted where created", create5, tester5.getVMID());
      assertEquals("creation of 5 beans load balanced", create1, create5);
   }
View Full Code Here

Examples of java.rmi.dgc.VMID

      getLog().debug("Test Nested Stateful Bean Counter Failover with Remote");
      getLog().debug("======================================================");
     
      NestedBeanSet beanSet = runner.getNestedBeanSet();
      ParentStatefulRemote stateful = beanSet.parent;
      VMID node1 = stateful.getVMID();
      assertNotNull("State node: ", node1);
      getLog ().debug ("Node 1 ID: " +node1);

      assertEquals("Counter: ", 1, stateful.increment());
      assertEquals("Counter: ", 2, stateful.increment());
      sleep(300);

      // Now we switch to the other node, simulating a failure on node 1
      stateful.setUpFailover("once");
      VMID node2 = stateful.getVMID();
      assertNotNull("State node: ", node2);
      getLog ().debug ("Node 2 ID : " +node2);

      assertFalse("Failover has occured", node1.equals(node2));
View Full Code Here

Examples of java.rmi.dgc.VMID

      getLog().debug("Test Nested Stateful Bean Counter Failover");
      getLog().debug("==========================================");
     
      NestedBeanSet beanSet = runner.getNestedBeanSet();
      ParentStatefulRemote stateful = beanSet.parent;
      VMID node1 = stateful.getVMID();
      assertNotNull("State node: ", node1);
      getLog ().debug ("Node 1 ID: " +node1);

      assertEquals("Counter: ", 1, stateful.incrementLocal());
      assertEquals("Counter: ", 2, stateful.incrementLocal());
      sleep(300);

      // Now we switch to the other node, simulating a failure on node 1
      stateful.setUpFailover("once");
      VMID node2 = stateful.getVMID();
      assertNotNull("State node: ", node2);
      getLog ().debug ("Node 2 ID : " +node2);

      assertFalse("Failover has occured", node1.equals(node2));
View Full Code Here

Examples of java.rmi.dgc.VMID

     
      Context ctx = new InitialContext(env);
     
      getLog().debug("Looking up NestedBeanMonitorBean...");
      NestedBeanMonitor monitor = (NestedBeanMonitor) ctx.lookup("NestedBeanMonitorBean/remote");
      VMID monitorVM = monitor.getVMID();
      runner.addRemovable(monitor);
      ParentStatefulRemote parent = null;     
      boolean vmMatch = true;
      for (int i = 0; i < 20 && vmMatch; i++)
      {
         env.put(NamingContext.PROVIDER_URL, namingURLS[i % 2]);        
         ctx = new InitialContext(env);
        
         getLog().debug("Looking up testParentStateful... Attempt " + (i + 1));
         parent = (ParentStatefulRemote) ctx.lookup("testParentStateful/remote");

         VMID parentVM = parent.getVMID();
         vmMatch = monitorVM.equals(parentVM);
         runner.addRemovable(parent);
         if (vmMatch)
         {
            runner.removeBean(parent);
View Full Code Here

Examples of java.rmi.dgc.VMID

      // We want a colocated monitor and SFSB to test passivation/destruction
      // StatelessRemoteBean is not clustered, so once we have it's VMID
      // we can keep creating SFSBs until we get one we want
      getLog().debug("Looking up NestedBeanMonitorBean...");
      NestedBeanMonitor monitor = (NestedBeanMonitor) getInitialContext().lookup("NestedBeanMonitorBean/remote");
      VMID monitorVM = monitor.getVMID();
      addRemovable(monitor);
     
      int parentInv = 0;
      int nestedInv = 0;
     
      ParentStatefulRemote parent = null;     
      boolean vmMatch = false;
      for (int i = 0; i < 20 && !vmMatch; i++)
      {
         getLog().debug("Looking up testParentStateful... Attempt " + (i + 1));
         parent = (ParentStatefulRemote) initialContext.lookup("testParentStateful/remote");
        
         vmMatch = monitorVM.equals(parent.getVMID());
         addRemovable(parent);
         if (!vmMatch)
         {
            removeBean(parent);
         }
View Full Code Here

Examples of java.rmi.dgc.VMID

      // We want a colocated SLSB and SFSB to test passivation/destruction
      // VMIDTrackerBean is not clustered, so once we have it's VMID
      // we can keep creating SFSBs until we get one we want
      getLog().debug("Looking up VMTrackerBean...");
      VMTracker tracker = (VMTracker) getInitialContext(0).lookup("VMTrackerBean/remote");
      VMID monitorVM = tracker.getVMID();
     
      NodeAnswer node0 = null;
      boolean vmMatch = false;
      for (int i = 0; i < 10 && !vmMatch; i++)
      {
         getLog().debug("Looking up testStateful/remote... Attempt " + i +1);
         stateful = (StatefulRemote) ctx.lookup("testStateful/remote");
        
         node0 = stateful.getNodeState();
         vmMatch = monitorVM.equals(node0.getNodeId());
         if (!vmMatch)
         {
            stateful.remove();
         }
      }
View Full Code Here

Examples of java.rmi.dgc.VMID

      Assert.assertFalse("Got a non-ERROR deepId", "ERROR".equals(deepId));
      String localDeepId = monitor.getLocalDeepNestedId();
      Assert.assertNotNull("Got a localDeepId", localDeepId);
      Assert.assertFalse("Got a non-ERROR localDeepId", "ERROR".equals(localDeepId));
     
      VMID origId = parent.getVMID();
      Assert.assertNotNull("Got a VMID", origId);
     
      long id = parent.createCustomer()
      Customer customer = parent.find(id);
      Assert.assertNotNull("Customer created and found on parent", customer);
     
      parent.setContainedCustomer();
      Assert.assertTrue("Parent and contained share customer", parent.checkContainedCustomer());
     
      Assert.assertTrue("Parent and remote nested do not share ref",
                        monitor.compareTopToNested(id));
      Assert.assertTrue("Parent and local nested do share ref",
                         monitor.compareTopToLocalNested(id));
      Assert.assertTrue("Remote nested and local nested do not share a ref",
                        monitor.compareNestedToLocalNested(id));
      Assert.assertTrue("Remote nested and deepNested share a ref",
                        monitor.compareNestedToDeepNested(id));
      Assert.assertTrue("Local nested and localDeepNested share a ref",
                        monitor.compareLocalNestedToLocalDeepNested(id));
     
      VMID newId = parent.getVMID();
      Assert.assertTrue("VMID remained the same", origId.equals(newId));
     
      if (passivate)
      {
         runner.sleep();
View Full Code Here

Examples of java.rmi.dgc.VMID

  
   public void ejbCreate(String name) throws RemoteException, CreateException
   {
      super.ejbCreate(name);

      this.myId = new VMID();
      log.debug("My ID: " + this.myId);
   }
View Full Code Here

Examples of java.rmi.dgc.VMID

   {
      super.ejbActivate();
      if (this.myId == null)
      {
         //it is a failover: we need to assign ourself an id
         this.myId = new VMID();
      }
      log.debug("Activate. My ID: " + this.myId + " name: " + this.name);
   }
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.