Examples of CreateConnectionResult


Examples of org.jboss.jms.delegate.CreateConnectionResult

      os.flush();
   }
  
   public void read(DataInputStream is) throws Exception
   {
      res = new CreateConnectionResult();
     
      res.read(is);
   }
View Full Code Here

Examples of org.jboss.jms.delegate.CreateConnectionResult

            ClientConnectionDelegate cd =
               createConnectionDelegateInternal(username, password, failedNodeID,
                                                remotingSessionID, clientVMID,
                                                versionToUse,
                                                callbackHandler);
            return new CreateConnectionResult(cd);
         }
         else
         {
            log.trace(this + " received client-side failover request. Creating failover "+
               "connection to replace connection to failed node " + failedNodeID);

            // Wait for server side failover to complete
            int failoverNodeID = serverPeer.getFailoverWaiter().waitForFailover(failedNodeID);
           
            if (failoverNodeID == -1 || failoverNodeID != serverPeer.getServerPeerID())
            {
               log.trace(this + " realized that we are on the wrong node or no failover has occured");
               return new CreateConnectionResult(failoverNodeID);
            }
            else
            {
               log.trace(this + " received notification that server-side failover completed, " +
                  "creating connection delegate ...");
               ClientConnectionDelegate cd =
                  createConnectionDelegateInternal(username, password, failedNodeID,
                                                   remotingSessionID, clientVMID,
                                                   versionToUse,
                                                   callbackHandler);
               return new CreateConnectionResult(cd);
            }
         }
      }
      catch (Throwable t)
      {
View Full Code Here

Examples of org.jboss.jms.delegate.CreateConnectionResult

      log.debug("failure detected by " + source, reason);

      // generate a FAILURE_DETECTED event
      broadcastFailoverEvent(new FailoverEvent(FailoverEvent.FAILURE_DETECTED, source));

      CreateConnectionResult res = null;
     
      boolean failoverSuccessful = false;
     
      boolean valveOpened = false;

      int failoverEvent = FailoverEvent.FAILOVER_COMPLETED;
     
      try
      {
         // block any other invocations ariving to any delegate from the hierarchy while we're
         // doing failover

         valve.close();
        
         synchronized(this)
         {
            // testing for failed connection and setting the failed flag need to be done in one
            // atomic operation, otherwise multiple threads can get to perform the client-side
            // failover concurrently
            if (remotingConnection.isFailed())
            {
               log.debug(this + " ignoring failure detection notification, as failover was " +
                  "already (or is in process of being) performed on this connection");
              
               failoverSuccessful = true;

               failoverEvent = FailoverEvent.FAILOVER_ALREADY_COMPLETED;
              
               //Return true since failover already completed ok
               return true;
            }

            remotingConnection.setFailed();
         }
        
         // Note - failover doesn't occur until _after_ the above check - so the next comment
         // belongs here
         log.info("JBoss Messaging server failure detected - waiting for failover to complete...");
        
         // generate a FAILOVER_STARTED event. The event must be broadcasted AFTER valve closure,
         // to insure the client-side stack is in a deterministic state
         broadcastFailoverEvent(new FailoverEvent(FailoverEvent.FAILOVER_STARTED, this));       
        
         int failedNodeID = state.getServerID();
                 
         ConnectionFactoryDelegate clusteredDelegate = state.getClusteredConnectionFactoryDelegate();
                          
         // try recreating the connection
         log.trace("Creating new connection");
         res = clusteredDelegate.
            createConnectionDelegate(state.getUsername(), state.getPassword(), failedNodeID);
         log.trace("Created connection");
        
         if (res == null)
         {
            // Failover did not occur
            failoverSuccessful = false;
            log.trace("No failover");
         }
         else
         {     
            // recursively synchronize state
            ClientConnectionDelegate newDelegate = (ClientConnectionDelegate)res.getDelegate();
           
            log.trace("Synchronizing state");
            state.getDelegate().synchronizeWith(newDelegate);
            log.trace("Synchronized state");
           
View Full Code Here

Examples of org.jboss.jms.delegate.CreateConnectionResult

     
      byte v = version.getProviderIncrementingVersion();
                      
      JMSRemotingConnection remotingConnection = null;
     
      CreateConnectionResult res;
     
      try
      {        
         remotingConnection = new JMSRemotingConnection(serverLocatorURI, clientPing, strictTck);
        
         remotingConnection.start();
  
         Client client = remotingConnection.getRemotingClient();
        
         String remotingSessionId = client.getSessionId();
        
         String clientVMId = JMSClientVMIdentifier.instance;
           
         ConnectionFactoryCreateConnectionDelegateRequest req =
            new ConnectionFactoryCreateConnectionDelegateRequest(id, v,
                                                                 remotingSessionId, clientVMId,
                                                                 username, password, failedNodeID);
          
         ResponseSupport rs = (ResponseSupport)client.invoke(req, null);
        
         res = (CreateConnectionResult)rs.getResponse();
      }
      catch (Throwable t)
      {
         //If we were invoking createConnectionDelegate and failure occurs then we need to clear
         // up the JMSRemotingConnection

         if (remotingConnection != null)
         {
            try
            {
               remotingConnection.stop();
            }
            catch (Throwable ignore)
            {
            }
         }
        
         throw handleThrowable(t);
      }
        
      ClientConnectionDelegate connectionDelegate = (ClientConnectionDelegate)res.getDelegate();
     
      if (connectionDelegate != null)
      {
         connectionDelegate.setRemotingConnection(remotingConnection);
        
View Full Code Here

Examples of org.jboss.jms.delegate.CreateConnectionResult

      }

      // The version used by the connection is the minimum of the server version for the
      // connection factory and the client code version

      CreateConnectionResult res = delegate.createConnectionDelegate(username, password, -1);

      return new JBossConnection(res.getDelegate(), type);
   }
View Full Code Here

Examples of org.jboss.jms.delegate.CreateConnectionResult

      log.debug("failure detected by " + source, reason);

      // generate a FAILURE_DETECTED event
      broadcastFailoverEvent(new FailoverEvent(FailoverEvent.FAILURE_DETECTED, source));

      CreateConnectionResult res = null;
     
      boolean failoverSuccessful = false;
     
      boolean valveOpened = false;

      int failoverEvent = FailoverEvent.FAILOVER_COMPLETED;
     
      try
      {
         // block any other invocations ariving to any delegate from the hierarchy while we're
         // doing failover

         valve.close();
        
         synchronized(this)
         {
            // testing for failed connection and setting the failed flag need to be done in one
            // atomic operation, otherwise multiple threads can get to perform the client-side
            // failover concurrently
            if (remotingConnection.isFailed())
            {
               log.debug(this + " ignoring failure detection notification, as failover was " +
                  "already (or is in process of being) performed on this connection");
              
               failoverSuccessful = true;

               failoverEvent = FailoverEvent.FAILOVER_ALREADY_COMPLETED;
              
               //Return true since failover already completed ok
               return true;
            }

            remotingConnection.setFailed();
         }
        
         // Note - failover doesn't occur until _after_ the above check - so the next comment
         // belongs here
         log.info("JBoss Messaging server failure detected - waiting for failover to complete...");
        
         // generate a FAILOVER_STARTED event. The event must be broadcasted AFTER valve closure,
         // to insure the client-side stack is in a deterministic state
         broadcastFailoverEvent(new FailoverEvent(FailoverEvent.FAILOVER_STARTED, this));       
        
         int failedNodeID = state.getServerID();
                 
         ConnectionFactoryDelegate clusteredDelegate = state.getClusteredConnectionFactoryDelegate();
                          
         // try recreating the connection
         log.trace("Creating new connection");
         res = clusteredDelegate.
            createConnectionDelegate(state.getUsername(), state.getPassword(), failedNodeID);
         log.trace("Created connection");
        
         if (res == null)
         {
            // Failover did not occur
            failoverSuccessful = false;
            log.trace("No failover");
         }
         else
         {     
            // recursively synchronize state
            ClientConnectionDelegate newDelegate = (ClientConnectionDelegate)res.getDelegate();
           
            log.trace("Synchronizing state");
            state.getDelegate().synchronizeWith(newDelegate);
            log.trace("Synchronized state");
           
View Full Code Here

Examples of org.jboss.jms.delegate.CreateConnectionResult

            ClientConnectionDelegate cd =
               createConnectionDelegateInternal(username, password, failedNodeID,
                                                remotingSessionID, clientVMID,
                                                versionToUse,
                                                callbackHandler);
            return new CreateConnectionResult(cd);
         }
         else
         {
            log.trace(this + " received client-side failover request. Creating failover "+
               "connection to replace connection to failed node " + failedNodeID);

            // Wait for server side failover to complete
            int failoverNodeID = serverPeer.getFailoverWaiter().waitForFailover(failedNodeID);
           
            if (failoverNodeID == -1 || failoverNodeID != serverPeer.getServerPeerID())
            {
               log.trace(this + " realized that we are on the wrong node or no failover has occured");
               return new CreateConnectionResult(failoverNodeID);
            }
            else
            {
               log.trace(this + " received notification that server-side failover completed, " +
                  "creating connection delegate ...");
               ClientConnectionDelegate cd =
                  createConnectionDelegateInternal(username, password, failedNodeID,
                                                   remotingSessionID, clientVMID,
                                                   versionToUse,
                                                   callbackHandler);
               return new CreateConnectionResult(cd);
            }
         }
      }
      catch (Throwable t)
      {
View Full Code Here

Examples of org.jboss.jms.delegate.CreateConnectionResult

   // Public ---------------------------------------------------------------------------------------

   public Object handleCreateConnectionDelegate(Invocation inv) throws Throwable
   {
      CreateConnectionResult res = (CreateConnectionResult)inv.invokeNext();

      ClientConnectionDelegate connectionDelegate = (ClientConnectionDelegate)res.getDelegate();

      if (connectionDelegate != null && connectionDelegate.getState() == null)
      {
         // no state set yet, initialize and configure it
View Full Code Here

Examples of org.jboss.jms.delegate.CreateConnectionResult

            }

            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)
            {
               // valid connection

               log.trace(this + " got local connection delegate " + cd);
              
               if (supportsFailover)
               {
                 ConnectionState state = (ConnectionState)((DelegateSupport)cd).getState();
 
                 state.initializeFailoverCommandCenter();
 
                 FailoverCommandCenter fcc = state.getFailoverCommandCenter();
 
                 // add a connection listener to detect failure; the consolidated remoting connection
                 // listener must be already in place and configured
                 state.getRemotingConnection().getConnectionListener().
                    setDelegateListener(new ConnectionFailureListener(fcc, state.getRemotingConnection()));
 
                 log.trace(this + " installed failure listener on " + cd);
 
                 // also cache the username and the password into state, useful in case
                 // FailoverCommandCenter needs to create a new connection instead of a failed on
                 state.setUsername(username);
                 state.setPassword(password);
 
                 // also add a reference to the clustered ConnectionFactory delegate, useful in case
                 // FailoverCommandCenter needs to create a new connection instead of a failed on
                 state.setClusteredConnectionFactoryDeleage(clusteredDelegate);
                
                 log.trace("Successfully initialised new connection");
               }

               return res;
            }
            else
            {
              // This should never occur if we are not doing failover
              if (!supportsFailover)
              {
                throw new IllegalStateException("Doesn't support failover so must return a connection delegate");
              }
             
               // we did not get a valid connection to the node we've just tried

               int actualServerID = res.getActualFailoverNodeID();

               if (actualServerID == -1)
               {
                  // No failover attempt was detected on the server side; this might happen if the
                  // client side network fails temporarily so the client connection breaks but the
View Full Code Here

Examples of org.jboss.jms.delegate.CreateConnectionResult

     
      // Connection Factory
     
      public void testConnectionFactoryCreateConnectionDelegateResponse() throws Exception
      {
         CreateConnectionResult res = new CreateConnectionResult(123);
        
         ResponseSupport resp =
            new ConnectionFactoryCreateConnectionDelegateResponse(res);
                
         testPacket(resp, PacketSupport.RESP_CONNECTIONFACTORY_CREATECONNECTIONDELEGATE);                          
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.