Examples of ConnectionState


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

      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

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

      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

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

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

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

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

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

   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

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

      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

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

   {
      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

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

   {
      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

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

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

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

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

      sess.commit();
     
      ClientSessionDelegate del = (ClientSessionDelegate)((JBossSession)sess).getDelegate();
     
      SessionState state = (SessionState)del.getState();
      ConnectionState cState = (ConnectionState)state.getParent();
     
      Object xid = state.getCurrentTxId();
      assertNotNull(xid);
      assertNotNull(cState.getResourceManager().getTx(xid));
     
      //Now close the session
      sess.close();
     
      //Session should be removed from resource manager
      xid = state.getCurrentTxId();
      assertNotNull(xid);
      assertNull(cState.getResourceManager().getTx(xid));
     
      conn.close();
     
      assertEquals(0, cState.getResourceManager().size());
   }
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.