Package org.jboss.ha.core.framework.server

Examples of org.jboss.ha.core.framework.server.DistributedReplicantManagerImpl


  
   @ManagementOperation(description="List all known DistributedReplicantManager keys and the nodes that have registered bindings",
         impact=Impact.ReadOnly)
   public String listDRMContent() throws Exception
   {
      DistributedReplicantManagerImpl drm = getDistributedReplicantManagerImpl();
      return drm == null ? null : drm.listContent();
   }
View Full Code Here


   @ManagementOperation(description="List in XML format all known DistributedReplicantManager keys and the nodes that have registered bindings",
         impact=Impact.ReadOnly)
   public String listDRMContentAsXml() throws Exception
   {
      DistributedReplicantManagerImpl drm = getDistributedReplicantManagerImpl();
      return drm == null ? null : drm.listXmlContent();
   }
View Full Code Here

                        impact=Impact.ReadOnly,
                        params={@ManagementParameter(name="key",
                                                     description="The name of the service")})
   public List<String> lookupDRMNodeNames(String key)
   {
      DistributedReplicantManagerImpl drm = getDistributedReplicantManagerImpl();
      return drm == null ? null : drm.lookupReplicantsNodeNames(key);
   }
View Full Code Here

                        impact=Impact.ReadOnly,
                        params={@ManagementParameter(name="key",
                                                     description="The name of the service")})
   public int getDRMServiceViewId(String key)
   {
      DistributedReplicantManagerImpl drm = getDistributedReplicantManagerImpl();
      return drm == null ? null : drm.getReplicantsViewId(key);
   }
View Full Code Here

   @ManagementOperation(description="Returns whether the DistributedReplicantManager considers this node to be the master for the given service",
         impact=Impact.ReadOnly,
         params={@ManagementParameter(name="key", description="The name of the service")})
   public boolean isDRMMasterForService(String key)
   {
      DistributedReplicantManagerImpl drm = getDistributedReplicantManagerImpl();
      return drm == null ? null : drm.isMasterReplica(key);
   }
View Full Code Here

  
   @ManagementOperation(description="Get a collection of the names of all keys for which the DistributedReplicantManager has bindings",
         impact=Impact.ReadOnly)
   public Collection<String> getDRMServiceNames()
   {
      DistributedReplicantManagerImpl drm = getDistributedReplicantManagerImpl();
      return drm == null ? null : drm.getAllServices();
   }
View Full Code Here

         MBeanServerFactory.createMBeanServer("mockPartition");
      try {
         ClusterNode localAddress = factory.getClusterNode(new IpAddress("localhost", 12345));
         MockHAPartition partition = new MockHAPartition(localAddress);
     
         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl(partition);

         drm.createService();
        
         // Create a fake view for the MockHAPartition
        
         Vector<ClusterNode> remoteAddresses = new Vector<ClusterNode>();
         for (int i = 1; i < 5; i++)
            remoteAddresses.add(factory.getClusterNode(new IpAddress("localhost", 12340 + i)));
        
         Vector<ClusterNode> allNodes = new Vector<ClusterNode>(remoteAddresses);
         allNodes.add(localAddress);
         partition.setCurrentViewClusterNodes(allNodes);
        
         drm.startService();
        
         BlockingListenerThread blt =
            new BlockingListenerThread(drm, true, null);
        
         // Hold the lock monitor so the test thread can't acquire it
         // This keeps the blocking thread alive.
         synchronized(lock) {
            // Spawn a thread that will change a key and then block on the
            // notification back to itself
            blt.start();

            sleepThread(50);
           
            assertTrue("Test thread is alive", blt.isAlive());           
            assertTrue("Test thread is blocking", blt.isBlocking());
           
            RegistrationThread rt = new RegistrationThread(drm);
            rt.start();

            sleepThread(50);
           
            assertTrue("No deadlock on listener registration", rt.isRegistered());
           
            assertTrue("No deadlock on listener unregistration", rt.isUnregistered());
           
            assertNull("No exception in deadlock tester", blt.getException());
           
            assertTrue("Test thread is still blocking", blt.isBlocking());
            assertTrue("Test thread is still alive", blt.isAlive());
         }
        
         drm.unregisterListener("TEST", blt);
        
         sleepThread(50);
        
         // Test going through remove
         blt = new BlockingListenerThread(drm, false, null);
View Full Code Here

         MBeanServerFactory.createMBeanServer("mockPartition");
      try {
         ClusterNode localAddress = factory.getClusterNode(new IpAddress("localhost", 12345));
         MockHAPartition partition = new MockHAPartition(localAddress);
     
         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl(partition);

         drm.createService();
        
         // Create a fake view for the MockHAPartition
        
         Vector<ClusterNode> remoteAddresses = new Vector<ClusterNode>();
         for (int i = 1; i < 5; i++)
            remoteAddresses.add(factory.getClusterNode(new IpAddress("localhost", 12340 + i)));
        
         Vector<ClusterNode> allNodes = new Vector<ClusterNode>(remoteAddresses);
         allNodes.add(localAddress);
         partition.setCurrentViewClusterNodes(allNodes);
        
         drm.startService();
        
         String sender = ((ClusterNode)remoteAddresses.get(0)).getName();
         BlockingListenerThread blt =
            new BlockingListenerThread(drm, true, sender);
        
         // Hold the lock monitor so the test thread can't acquire it
         // This keeps the blocking thread alive.
         synchronized(lock) {
            // Spawn a thread that will change a key and then block on the
            // notification back to itself
            blt.start();

            sleepThread(50);
           
            assertFalse("JGroups thread is not alive", blt.isAlive());           
            assertTrue("Async handler thread is blocking", blt.isBlocking());
           
            assertNull("No exception in JGroups thread", blt.getException());
         }
        
         drm.unregisterListener("TEST", blt);
        
         sleepThread(50);
        
         // Test going through remove
         blt = new BlockingListenerThread(drm, false, sender);
View Full Code Here

      try {
       
         ClusterNode localAddress = factory.getClusterNode(new IpAddress("localhost", 12345));
         MockHAPartition partition = new MockHAPartition(localAddress);
     
         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl(partition);

         drm.createService();
        
         // Create a fake view for the MockHAPartition
        
         Vector<ClusterNode> remoteAddresses = new Vector<ClusterNode>();
         ClusterNode remote = factory.getClusterNode(new IpAddress("localhost", 12341));
         remoteAddresses.add(remote);
        
         Vector<ClusterNode> allNodes = new Vector<ClusterNode>(remoteAddresses);
         allNodes.add(localAddress);
         partition.setCurrentViewClusterNodes(allNodes);
        
         drm.startService();
        
         MockDeployer deployer = new MockDeployer(drm);
        
         if (!conflicting)
         {
            // Register a MockHASingletonDeployer, but since we're in
            // non-conflicting mode, the DeployerThreads won't deal with it
            MockHASingletonDeployer listener =
                  new MockHASingletonDeployer(deployer, "HASingleton", log);
           
            drm.registerListener("HASingleton", listener);
            drm.add("HASingleton", "HASingleton");           
         }
        
         // Create a semaphore to gate the threads and acquire all its permits
         Semaphore semaphore = new Semaphore(count + 1);
         for (int i = 0; i <= count; i++)
View Full Code Here

         }
        
         MockHAPartition partition = new MockHAPartition(nodes[2]);
         partition.setCurrentViewClusterNodes(allNodes);
        
         DistributedReplicantManagerImpl drm = new DistributedReplicantManagerImpl(partition);
         drm.createService();
         drm.startService();
        
         CachingListener listener = new CachingListener();
         drm.registerListener("TEST", listener);
        
         SecureRandom random = new SecureRandom();
         boolean[] added = new boolean[nodes.length];
         List lookup = null;
         for (int i = 0; i < 10; i++)
         {
            int node = random.nextInt(nodes.length);
            if (added[node])
            {
               if (node == 2)
                  drm.remove("TEST");
               else
                  drm._remove("TEST", nodes[node].getName());
               added[node] = false;
            }
            else
            {    
               if (node == 2)
                  drm.add("TEST", replicants[node]);
               else
                  drm._add("TEST", nodes[node].getName(), replicants[node]);  
               added[node] = true;
            }
           
            // Confirm the proper order of the replicant node names
            lookup = maskListClass(drm.lookupReplicantsNodeNames("TEST"));
            confirmReplicantList(lookup, names, added);
           
            // Confirm the proper order of the replicants via lookupReplicants
            lookup = maskListClass(drm.lookupReplicants("TEST"));
            confirmReplicantList(lookup, replicants, added);
           
            // Confirm the listener got the same list
//            assertEquals("Listener received a correct list", lookup,
//                         maskListClass(listener.replicants));
View Full Code Here

TOP

Related Classes of org.jboss.ha.core.framework.server.DistributedReplicantManagerImpl

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.