Package org.jboss.jms.tx

Examples of org.jboss.jms.tx.ResourceManager


        
         ClientConnectionDelegate del = (ClientConnectionDelegate)jbConn.getDelegate();
        
         ConnectionState state = (ConnectionState)del.getState();
        
         ResourceManager rm = state.getResourceManager();
        
         Session session = conn.createSession(true, Session.SESSION_TRANSACTED);
                 
         for (int i = 0; i < 100; i++)
         {
            assertEquals(1, rm.size());
           
            session.commit();
           
            assertEquals(1, rm.size());
         }                 
        
         assertEquals(1, rm.size());
        
         conn.close();
        
         conn = null;
        
         assertEquals(0, rm.size());
      }
      finally
      {
         if (conn != null)
         {
View Full Code Here


/*     */     {
/* 103 */       if (this.trace) log.trace("Session is XA");
/*     */
/* 105 */       ConnectionState connState = (ConnectionState)state.getParent();
/*     */
/* 107 */       ResourceManager rm = connState.getResourceManager();
/*     */
/* 118 */       if (rm.checkForAcksInSession(state.getSessionID()))
/*     */       {
/* 120 */         throw new IllegalStateException("Attempt to close an XASession when there are still uncommitted acknowledgements!");
/*     */       }
/*     */
/*     */     }
/*     */
/* 125 */     int ackMode = state.getAcknowledgeMode();
/*     */
/* 131 */     if ((ackMode == 1) || (isXAAndConsideredNonTransacted(state)))
/*     */     {
/* 135 */       DeliveryInfo remainingAutoAck = state.getAutoAckInfo();
/*     */
/* 137 */       if (remainingAutoAck != null)
/*     */       {
/* 139 */         if (this.trace) log.trace(this + " handleClosing(). Found remaining auto ack. Will ack " + remainingAutoAck);
/*     */
/*     */         try
/*     */         {
/* 143 */           ackDelivery(del, remainingAutoAck);
/*     */
/* 145 */           if (this.trace) log.trace(this + " acked it");
/*     */         }
/*     */         finally
/*     */         {
/* 149 */           state.setAutoAckInfo(null);
/*     */         }
/*     */       }
/*     */     }
/* 153 */     else if (ackMode == 3)
/*     */     {
/* 157 */       if (!state.getClientAckList().isEmpty())
/*     */       {
/*     */         try
/*     */         {
/* 161 */           acknowledgeDeliveries(del, state.getClientAckList());
/*     */         }
/*     */         finally
/*     */         {
/* 165 */           state.getClientAckList().clear();
/*     */
/* 167 */           state.setAutoAckInfo(null);
/*     */         }
/*     */       }
/*     */     }
/* 171 */     else if (ackMode == 2)
/*     */     {
/* 181 */       cancelDeliveries(del, state.getClientAckList());
/*     */
/* 183 */       state.getClientAckList().clear();
/*     */     }
/* 185 */     else if ((state.isTransacted()) && (!state.isXA()))
/*     */     {
/* 190 */       ConnectionState connState = (ConnectionState)state.getParent();
/*     */
/* 192 */       ResourceManager rm = connState.getResourceManager();
/*     */
/* 194 */       List dels = rm.getDeliveriesForSession(state.getSessionID());
/*     */
/* 196 */       cancelDeliveries(del, dels);
/*     */     }
/*     */
/* 199 */     return invocation.invokeNext();
View Full Code Here

/*     */     {
/* 583 */       throw new TransactionInProgressException("Cannot call rollback on an XA session");
/*     */     }
/*     */
/* 586 */     ConnectionState connState = (ConnectionState)state.getParent();
/* 587 */     ResourceManager rm = connState.getResourceManager();
/*     */     try
/*     */     {
/* 590 */       rm.rollbackLocal((LocalTx)state.getCurrentTxId());
/*     */     }
/*     */     finally
/*     */     {
/*     */       Object xid;
/* 595 */       Object xid = rm.createLocalTx();
/* 596 */       state.setCurrentTxId(xid);
/*     */     }
/*     */
/* 599 */     return null;
/*     */   }
View Full Code Here

/* 267 */         log.trace(this + " synchronized failover browser " + browserDelegate);
/*     */       }
/*     */     }
/*     */
/* 271 */     ConnectionState connState = (ConnectionState)getParent();
/* 272 */     ResourceManager rm = connState.getResourceManager();
/*     */
/* 275 */     rm.handleFailover(connState.getServerID(), oldSessionID, newState.sessionID);
/*     */
/* 277 */     List ackInfos = Collections.EMPTY_LIST;
/*     */
/* 279 */     if ((!isTransacted()) || ((isXA()) && (getCurrentTxId() == null)))
/*     */     {
/* 287 */       log.trace(this + " is not transacted (or XA with no transaction set), " + "retrieving deliveries from session state");
/*     */
/* 293 */       if (this.acknowledgeMode == 2)
/*     */       {
/* 295 */         for (Iterator i = getClientAckList().iterator(); i.hasNext(); )
/*     */         {
/* 297 */           DeliveryInfo info = (DeliveryInfo)i.next();
/* 298 */           if (!info.getMessageProxy().getMessage().isReliable())
/*     */           {
/* 300 */             i.remove();
/* 301 */             log.trace("removed non persistent delivery " + info);
/*     */           }
/*     */         }
/*     */
/* 305 */         ackInfos = getClientAckList();
/*     */       }
/*     */       else
/*     */       {
/* 309 */         DeliveryInfo autoAck = getAutoAckInfo();
/* 310 */         if (autoAck != null)
/*     */         {
/* 312 */           if (!autoAck.getMessageProxy().getMessage().isReliable())
/*     */           {
/* 315 */             setAutoAckInfo(null);
/*     */           }
/*     */           else
/*     */           {
/* 320 */             ackInfos = new ArrayList();
/* 321 */             ackInfos.add(autoAck);
/*     */           }
/*     */         }
/*     */       }
/*     */
/* 326 */       log.trace(this + " retrieved " + ackInfos.size() + " deliveries");
/*     */     }
/*     */     else
/*     */     {
/* 333 */       ackInfos = rm.getDeliveriesForSession(getSessionID());
/*     */     }
/*     */
/* 336 */     List recoveryInfos = new ArrayList();
/*     */     Iterator i;
/* 337 */     if (!ackInfos.isEmpty())
View Full Code Here

            log.trace(this + " synchronized failover browser " + browserDelegate);
         }
      }

      ConnectionState connState = (ConnectionState)getParent();
      ResourceManager rm = connState.getResourceManager();

      // We need to failover from one session ID to another in the resource manager
      rm.handleFailover(connState.getServerID(), oldSessionID, newState.sessionID);

      List ackInfos = Collections.EMPTY_LIST;

      if (!isTransacted() || (isXA() && getCurrentTxId() == null))
      {
         // TODO - the check "(isXA() && getCurrentTxId() == null)" shouldn't be necessary any more
         // since xa sessions no longer fall back to non transacted
        
         // Non transacted session or an XA session with no transaction set (it falls back
         // to AUTO_ACKNOWLEDGE)

         log.trace(this + " is not transacted (or XA with no transaction set), " +
                   "retrieving deliveries from session state");

         // We remove any unacked non-persistent messages - this is because we don't want to ack
         // them since the server won't know about them and will get confused

         if (acknowledgeMode == Session.CLIENT_ACKNOWLEDGE)
         {
            for(Iterator i = getClientAckList().iterator(); i.hasNext(); )
            {
               DeliveryInfo info = (DeliveryInfo)i.next();
               if (!info.getMessageProxy().getMessage().isReliable())
               {
                  i.remove();
                  log.trace("removed non persistent delivery " + info);
               }
            }

            ackInfos = getClientAckList();
         }
         else
         {
            DeliveryInfo autoAck = getAutoAckInfo();
            if (autoAck != null)
            {
               if (!autoAck.getMessageProxy().getMessage().isReliable())
               {
                  // unreliable, discard
                  setAutoAckInfo(null);
               }
               else
               {
                  // reliable
                  ackInfos = new ArrayList();
                  ackInfos.add(autoAck);
               }
            }
         }

         log.trace(this + " retrieved " + ackInfos.size() + " deliveries");
      }
      else
      {
         // Transacted session - we need to get the acks from the resource manager. BTW we have
         // kept the old resource manager.

         ackInfos = rm.getDeliveriesForSession(getSessionID());
      }

      List recoveryInfos = new ArrayList();
      if (!ackInfos.isEmpty())
      {        
View Full Code Here

TOP

Related Classes of org.jboss.jms.tx.ResourceManager

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.