Package org.jboss.jms.client.state

Examples of org.jboss.jms.client.state.ConnectionState


         {
            // the session is non-XA and transacted, or XA and enrolled in a global transaction. An
            // XA session that has not been enrolled in a global transaction behaves as a
            // transacted session.
           
            ConnectionState connState = (ConnectionState)state.getParent();
  
            if (trace) { log.trace("sending acknowlegment transactionally, queueing on resource manager"); }
  
            // If the ack is for a delivery that came through via a connection consumer then we use
            // the connectionConsumer session as the session id, otherwise we use this sessions'
            // session ID
           
            ClientSessionDelegate connectionConsumerDelegate =
               (ClientSessionDelegate)info.getConnectionConsumerSession();
           
            int sessionId = connectionConsumerDelegate != null ?
               connectionConsumerDelegate.getID() : state.getSessionID();
           
            connState.getResourceManager().addAck(txID, sessionId, info);
         }       
      }
     
      return null;
   }
View Full Code Here


      if (state.isXA())
      {
         throw new TransactionInProgressException("Cannot call commit on an XA session");
      }

      ConnectionState connState = (ConnectionState)state.getParent();
      ConnectionDelegate conn = (ConnectionDelegate)connState.getDelegate();
 
      try
      {
         connState.getResourceManager().commitLocal((LocalTx)state.getCurrentTxId(), conn);
      }
      finally
      {
         //Start new local tx
         Object xid = connState.getResourceManager().createLocalTx();

         state.setCurrentTxId(xid);
      }
     
      //TODO on commit we don't want to ACK any messages that have exceeded the max delivery count OR
View Full Code Here

      if (state.isXA())
      {
         throw new TransactionInProgressException("Cannot call rollback on an XA session");
      }
     
      ConnectionState connState = (ConnectionState)state.getParent();
      ResourceManager rm = connState.getResourceManager();
      try
      {
         rm.rollbackLocal((LocalTx)state.getCurrentTxId());
      }
      finally
View Full Code Here

      {
         // the session is non-XA and transacted, or XA and enrolled in a global transaction, so
         // we add the message to a transaction instead of sending it now. An XA session that has
         // not been enrolled in a global transaction behaves as a non-transacted session.

         ConnectionState connState = (ConnectionState)state.getParent();
         MethodInvocation mi = (MethodInvocation)invocation;
         Message m = (Message)mi.getArguments()[0];

         if (trace) { log.trace("sending message " + m + " transactionally, queueing on resource manager txID=" + txID + " sessionID= " + state.getSessionID()); }

         connState.getResourceManager().addMessage(txID, state.getSessionID(), (JBossMessage)m);

         // ... and we don't invoke any further interceptors in the stack
         return null;
      }
View Full Code Here

         // We have one message id generator per unique server
         MessageIdGenerator idGenerator =
            MessageIdGeneratorFactory.instance.checkOutGenerator(serverID);

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

         listener.setConnectionState(connectionState);
         connectionDelegate.setState(connectionState);
      }
View Full Code Here

   public Object handleCreateSessionDelegate(Invocation invocation) throws Throwable
   {
      ClientSessionDelegate sessionDelegate = (ClientSessionDelegate)invocation.invokeNext();
      DelegateSupport delegate = (DelegateSupport)sessionDelegate;

      ConnectionState connectionState = (ConnectionState)getState(invocation);

      MethodInvocation mi = (MethodInvocation)invocation;
      boolean transacted = ((Boolean)mi.getArguments()[0]).booleanValue();
      int ackMode = ((Integer)mi.getArguments()[1]).intValue();
      boolean xa = ((Boolean)mi.getArguments()[2]).booleanValue();
View Full Code Here

      assertEquals(2, getServerId(conn2));

      assertEquals(1, getServerId(conn1));

      ConnectionState state = this.getConnectionState(conn1);

      // Disable Leasing for Failover
      state.getRemotingConnection().removeConnectionListener();

      ServerManagement.killAndWait(1);

      Thread.sleep(15000);
View Full Code Here

   {
      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
     
      assertTrue(rm1 == rm2);
     
      assertTrue(ResourceManagerFactory.instance.containsResourceManager(state2.getServerID()));
     
      conn1.close();
     
      //Check reference counting
      assertTrue(ResourceManagerFactory.instance.containsResourceManager(state2.getServerID()));
          
      conn2.close();
     
      assertFalse(ResourceManagerFactory.instance.containsResourceManager(state2.getServerID()))
     
      assertEquals(0, ResourceManagerFactory.instance.size());
   }
View Full Code Here

   {
      Connection conn1 = cf.createConnection();     
           
      ClientConnectionDelegate del1 = (ClientConnectionDelegate)((JBossConnection)conn1).getDelegate();
     
      ConnectionState state1 = (ConnectionState)del1.getState();
     
      MessageIdGenerator gen1 = state1.getIdGenerator();
     
      Connection conn2 = cf.createConnection();     
     
      ClientConnectionDelegate del2 = (ClientConnectionDelegate)((JBossConnection)conn2).getDelegate();
     
      ConnectionState state2 = (ConnectionState)del2.getState();
     
      MessageIdGenerator gen2 = state2.getIdGenerator();

      //Two connections for same server should share the same resource manager
     
      assertTrue(gen1 == gen2);
     
      assertTrue(MessageIdGeneratorFactory.instance.containsMessageIdGenerator(state2.getServerID()));
     
      conn1.close();
     
      //Check reference counting
      assertTrue(MessageIdGeneratorFactory.instance.containsMessageIdGenerator(state2.getServerID()));
          
      conn2.close();
     
      assertFalse(MessageIdGeneratorFactory.instance.containsMessageIdGenerator(state2.getServerID()));    
   }
View Full Code Here

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

   public String getRemotingClientSessionID()
   {
      ConnectionState state = (ConnectionState)((ClientConnectionDelegate)delegate).getState();
     
      return state.getRemotingConnection().getRemotingClient().getSessionId();
   }
View Full Code Here

TOP

Related Classes of org.jboss.jms.client.state.ConnectionState

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.