Package org.jboss.jms.server.endpoint

Examples of org.jboss.jms.server.endpoint.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


            }

            log.debug(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.debug(this + " got local connection delegate " + cd);

               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().
                  addDelegateListener(new ConnectionFailureListener(fcc, state.getRemotingConnection()));

               log.debug(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);

               return new CreateConnectionResult(cd);
            }
            else
            {
               // 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

     
      byte v = version.getProviderIncrementingVersion();
                      
      JMSRemotingConnection remotingConnection = null;
     
      CreateConnectionResult res;
     
      try
      {        
         remotingConnection = new JMSRemotingConnection(serverLocatorURI, clientPing);
        
         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

         }
  
         // 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);
      }
      finally
      {
         tccc.restore();
      }
View Full Code Here

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

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

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

      CreateConnectionResult res = null;
      boolean failoverSuccessful = false;
     
      boolean valveOpened = false;
     
      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");
               return;
            }

            remotingConnection.setFailed();
         }
        
         // Note - failover doesn't occur until _after_ the above check - so the next comment
         // belongs here
         log.debug(this + " starting client-side failover");
        
         // 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();
        
         // re-try creating the connection
         res = clusteredDelegate.
            createConnectionDelegate(state.getUsername(), state.getPassword(), failedNodeID);
        
         if (res == null)
         {
            // 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
            // server cluster is still up and running - in this case we don't perform failover.
            failoverSuccessful = false;
         }
         else
         {     
            // recursively synchronize state
            ClientConnectionDelegate newDelegate = (ClientConnectionDelegate)res.getDelegate();
           
            state.getDelegate().synchronizeWith(newDelegate);
                          
            valve.open();
            valveOpened = true;
View Full Code Here

      if (advised == null)
      {
         throw new IllegalStateException("Cannot find object in dispatcher with id " + objectId);
      }
     
      CreateConnectionResult del =
         advised.createConnectionDelegate(username, password, failedNodeId,
                                           remotingSessionId, clientVMId, version,
                                           callbackHandler);
     
      return new ConnectionFactoryCreateConnectionDelegateResponse(del);
View Full Code Here

     
      // 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

Related Classes of org.jboss.jms.server.endpoint.CreateConnectionResult

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.