Package org.jboss.jms.client.delegate

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


         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 void testResourceManagersForSameServer() throws Exception
   {
      Connection conn1 = cf.createConnection();     
           
      ClientConnectionDelegate del1 = (ClientConnectionDelegate)((JBossConnection)conn1).getDelegate();
     
      ConnectionState state1 = (ConnectionState)del1.getState();
     
      ResourceManager rm1 = state1.getResourceManager();
     
      Connection conn2 = cf.createConnection();     
     
      ClientConnectionDelegate del2 = (ClientConnectionDelegate)((JBossConnection)conn2).getDelegate();
     
      ConnectionState state2 = (ConnectionState)del2.getState();
     
      ResourceManager rm2 = state2.getResourceManager();

      //Two connections for same server should share the same resource manager
     
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");
            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

      // Need to synchronized to prevent a deadlock
      // See http://jira.jboss.com/jira/browse/JBMESSAGING-797
      synchronized (AspectManager.instance())
      {        
         return new ClientConnectionDelegate(connectionID, serverPeer.getServerPeerID());
      }
   }
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();

         // install the consolidated remoting connection listener; it will be de-installed on
         // connection closing by ConnectionAspect

         ConsolidatedRemotingConnectionListener listener =
            new ConsolidatedRemotingConnectionListener();

         remotingConnection.addConnectionListener(listener);

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

         ConnectionState connectionState =
            new ConnectionState(serverID, connectionDelegate,
                                remotingConnection, versionToUse);

         listener.setConnectionState(connectionState);
         
         connectionDelegate.setState(connectionState);
      }

      return res;
   }
View Full Code Here

TOP

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

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.