Package org.jboss.jms.client.delegate

Examples of org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate


      Collections.sort(localDels,
         new Comparator()
         {
            public int compare(Object obj1, Object obj2)
            {
               ClientConnectionFactoryDelegate del1 = (ClientConnectionFactoryDelegate)obj1;
               ClientConnectionFactoryDelegate del2 = (ClientConnectionFactoryDelegate)obj2;
               return del1.getServerID() - del2.getServerID();
            }
         });

      return localDels;
   }
View Full Code Here


   {
     Iterator iter = factories.iterator();
     InvokerLocator prevLocator = null;
     while (iter.hasNext())
     {
       ClientConnectionFactoryDelegate fact = (ClientConnectionFactoryDelegate)iter.next();
      
       //Sanity check - the locator protocol and params MUST be the same on each node
       String locatorString = fact.getServerLocatorURI();
      
       InvokerLocator locator = new InvokerLocator(locatorString);
      
       if (prevLocator != null)
       {
View Full Code Here

      // We attempt to connect to the next node in a loop, since we might need to go through
      // multiple hops

      int attemptCount = 0;
      ClientConnectionFactoryDelegate delegate = null;

      while (attemptCount < MAX_RECONNECT_HOP_COUNT)
      {
         // since an exception might be captured during an attempt, this has to be the first
         // operation
         attemptCount++;

         int nextHopingServer = -1;
         try
         {
            int failedNodeIDToServer = -1;
            if (delegate == null)
            {
               if (failedNodeID != null && failedNodeID.intValue() >= 0)
               {
                 //It's a reconnect after failover
                  delegate = getFailoverDelegateForNode(failedNodeID);
                  failedNodeIDToServer = failedNodeID.intValue();
                  nextHopingServer = delegate.getServerID();
               }
               else
               {
                 //It's a first time create connection
                  LoadBalancingPolicy loadBalancingPolicy = clusteredDelegate.getLoadBalancingPolicy();                 
                  delegate = (ClientConnectionFactoryDelegate)loadBalancingPolicy.getNext();
               }
            }

            log.trace(this + " has chosen " + delegate + " as target, " +
               (attemptCount == 0 ? "first connection attempt" : attemptCount + " connection attempts"));
 
            CreateConnectionResult res = delegate.
               createConnectionDelegate(username, password, failedNodeIDToServer);
           
            ClientConnectionDelegate cd = (ClientConnectionDelegate)res.getDelegate();

            if (cd != null)
View Full Code Here

    {
      Map.Entry entry = (Map.Entry)iter.next();
     
      Integer nid = (Integer)entry.getKey();
     
      ClientConnectionFactoryDelegate delegate = (ClientConnectionFactoryDelegate)entry.getValue();
     
      if (connections.get(nid) == null)
      {
        try
        {
View Full Code Here

                                               "/TestConnectionFactory4",
                                               "clientid4",
                                               false);

      JBossConnectionFactory f1 = (JBossConnectionFactory)ic.lookup("/TestConnectionFactory1");
      ClientConnectionFactoryDelegate del1 = (ClientConnectionFactoryDelegate)f1.getDelegate();

      assertTrue(del1.getServerLocatorURI().startsWith("bisocket://localhost:1234"));

      JBossConnectionFactory f2 = (JBossConnectionFactory)ic.lookup("/TestConnectionFactory2");
      ClientConnectionFactoryDelegate del2 = (ClientConnectionFactoryDelegate)f2.getDelegate();
      assertTrue(del2.getServerLocatorURI().startsWith("bisocket://localhost:1235"));

      JBossConnectionFactory f3 = (JBossConnectionFactory)ic.lookup("/TestConnectionFactory3");
      ClientConnectionFactoryDelegate del3 = (ClientConnectionFactoryDelegate)f3.getDelegate();
      assertTrue(del3.getServerLocatorURI().startsWith("bisocket://localhost:1236"));

      JBossConnectionFactory f4 = (JBossConnectionFactory)ic.lookup("/TestConnectionFactory4");
      ClientConnectionFactoryDelegate del4 = (ClientConnectionFactoryDelegate)f4.getDelegate();
      assertTrue(del4.getServerLocatorURI().startsWith("bisocket://localhost:1236"));

      Connection con1 = f1.createConnection();
      Connection con2 = f2.createConnection();
      Connection con3 = f3.createConnection();
      Connection con4 = f4.createConnection();
View Full Code Here

   public void testRestartServer() throws Exception
   {
      JBossConnectionFactory cf2 = (JBossConnectionFactory) ic[1].lookup("/ConnectionFactory");

      ClientClusteredConnectionFactoryDelegate clusterCF = (ClientClusteredConnectionFactoryDelegate)cf.getDelegate();
      ClientConnectionFactoryDelegate delegates[] = clusterCF.getDelegates();
      clusterCF.closeCallback(false);

      ServerManagement.kill(1);

      //Restart the server on the same place
View Full Code Here

      boolean creatingClustered = (supportsFailover || supportsLoadBalancing) && replicator != null;
     
      //The server peer strict setting overrides the connection factory
      boolean useStrict = serverPeer.isStrictTck() || strictTck;

      ClientConnectionFactoryDelegate localDelegate =
         new ClientConnectionFactoryDelegate(uniqueName, id, serverPeer.getServerPeerID(),
                                             locatorURI, version, clientPing, useStrict,
                                             sendAcksAsync, enableOrderingGroup, defaultOrderingGroupName,
                                             maxRetryChangeRate, retryChangeRateInterval);

      log.debug(this + " created local delegate " + localDelegate);
View Full Code Here

      Collections.sort(localDels,
         new Comparator()
         {
            public int compare(Object obj1, Object obj2)
            {
               ClientConnectionFactoryDelegate del1 = (ClientConnectionFactoryDelegate)obj1;
               ClientConnectionFactoryDelegate del2 = (ClientConnectionFactoryDelegate)obj2;
               return del1.getServerID() - del2.getServerID();
            }
         });

      return localDels;
   }
View Full Code Here

   {
     Iterator iter = factories.iterator();
     InvokerLocator prevLocator = null;
     while (iter.hasNext())
     {
       ClientConnectionFactoryDelegate fact = (ClientConnectionFactoryDelegate)iter.next();
      
       //Sanity check - the locator protocol and params MUST be the same on each node
       String locatorString = fact.getServerLocatorURI();
      
       InvokerLocator locator = new InvokerLocator(locatorString);
      
       if (prevLocator != null)
       {
View Full Code Here

    {
      Map.Entry entry = (Map.Entry)iter.next();
     
      Integer nid = (Integer)entry.getKey();
     
      ClientConnectionFactoryDelegate delegate = (ClientConnectionFactoryDelegate)entry.getValue();
     
      if (connections.get(nid) == null)
      {
        try
        {
View Full Code Here

TOP

Related Classes of org.jboss.jms.client.delegate.ClientConnectionFactoryDelegate

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.