Package org.jboss.jms.client.delegate

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


         conn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)conn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();

         // Create a session
         XASession sess1 = conn.createXASession();
View Full Code Here


         conn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)conn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();

         // Create a session
         XASession sess1 = conn.createXASession();
View Full Code Here

         conn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)conn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();

         // Create a session
         XASession sess1 = conn.createXASession();
View Full Code Here

      {
         xaConn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)xaConn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();

         XASession xaSession = xaConn.createXASession();
View Full Code Here

      {
         xaConn = cf.createXAConnection();

         JBossConnection jbConn = (JBossConnection)xaConn;

         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();

         ConnectionState state = (ConnectionState)del.getState();

         ResourceManager rm = state.getResourceManager();

         XASession xaSession = xaConn.createXASession();
View Full Code Here

   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

         if(trace) { log.trace(connectionDelegate + " not configured, configuring ..."); }

         int serverID = connectionDelegate.getServerID();
         Version versionToUse = connectionDelegate.getVersionToUse();
         JMSRemotingConnection remotingConnection = connectionDelegate.getRemotingConnection();

         if (versionToUse == null)
         {
            throw new IllegalStateException("Connection version is null");
         }

         ConnectionState connectionState =
            new ConnectionState(serverID, connectionDelegate,
                                remotingConnection, versionToUse,
                                connectionDelegate.isEnableOrderingGroup(), connectionDelegate.getDefaultOrderingGroupName(),
                                connectionDelegate.getMaxRetryChangeRate(), connectionDelegate.getRetryChangeRateInterval());

         remotingConnection.getConnectionListener().setConnectionState(connectionState);
         remotingConnection.getConnectionListener().start();
         
         connectionDelegate.setState(connectionState);
      }

      return res;
   }
View Full Code Here

            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");
           
            //Now restart the connection if appropriate
            //Note! we mus start the connection while the valve is still closed
            //Otherwise If a consumer closing is waiting on failover to complete
            //Then on failover complete the valve will be opened and closing retried on a
            //different thread
            //but the next line will re-start the connection so there is a race between the two
            //If the restart hits after closing then messages can get delivered after consumer
            //is closed
           
            if (state.isStarted())
            {
               log.trace("Starting new connection");
               newDelegate.startAfterFailover();
               log.trace("Started new connection");
            }

            if(remotingConnection.getConnectionListener() != null &&
                    remotingConnection.getConnectionListener().getJMSExceptionListener() != null)
            {
               log.trace("Adding Exception Listener to new connection");
               newDelegate.setExceptionListener(remotingConnection.getConnectionListener().getJMSExceptionListener());
            }
            log.trace("Opening valve");
            valve.open();
            log.trace("Opened valve");
            valveOpened = true;
           
            failoverSuccessful = true;     
           
            log.info("JBoss Messaging failover complete");
         }
        
         log.trace("failureDetected() complete");
        
         return failoverSuccessful;
      }
      catch (Exception e)
      {
         log.error("Failover failed", e);

         throw e;
      }
      finally
      {
         if (!valveOpened)
         {
           log.trace("finally opening valve");
            valve.open();
            log.trace("valve opened");
         }

         if (failoverSuccessful)
         {
            log.debug(this + " completed successful failover");
            broadcastFailoverEvent(new FailoverEvent(failoverEvent, this));
         }
         else
         {
            log.debug(this + " aborted failover");
            state.beforeAborting();
           
            ClientConnectionDelegate connDelegate = (ClientConnectionDelegate)state.getDelegate();
            connDelegate.closing(-1);
            connDelegate.close();
           
            broadcastFailoverEvent(new FailoverEvent(FailoverEvent.FAILOVER_FAILED, this));
         }
      }
   }
View Full Code Here

      ConnectionState currentState = getConnectionState(invocation);
      currentState.setJustCreated(false);
     
      if (connMetaData == null)
      {
         ClientConnectionDelegate delegate = (ClientConnectionDelegate)invocation.getTargetObject();
         connMetaData = new JBossConnectionMetaData(((ConnectionState)delegate.getState()).getVersionToUse());
      }
     
      return connMetaData;
   }
View Full Code Here

  
   private ConnectionState getConnectionState(Invocation invocation)
   {
      if (state == null)
      {
         ClientConnectionDelegate currentDelegate =
            ((ClientConnectionDelegate)invocation.getTargetObject());
        
         state = (ConnectionState)currentDelegate.getState();
         id = state.getDelegate().getID();

      }
      return state;
   }
View Full Code Here

      try
      {
         if (failedNodeID == -1)
         {
            // Just a standard createConnection
            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);
View Full Code Here

TOP

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

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.