Package org.jboss.jms.server.endpoint

Examples of org.jboss.jms.server.endpoint.DeliveryInfo


        
         List acks = state.getAcks();
        
         if (!acks.isEmpty())
         {
            DeliveryInfo info = (DeliveryInfo)acks.get(0);
           
            MessageProxy mp = info.getMessageProxy();
           
            SessionDelegate del = mp.getSessionDelegate();
           
            del.redeliver(acks);
         }
View Full Code Here


         if (getAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE)
         {
            for(Iterator i = getClientAckList().iterator(); i.hasNext(); )
            {
               DeliveryInfo info = (DeliveryInfo)i.next();
               if (!info.getMessageProxy().getMessage().isReliable())
               {
                  i.remove();
                  log.debug("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.debug(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());
      }

      if (!ackInfos.isEmpty())
      {
         List recoveryInfos = new ArrayList();
         for (Iterator i = ackInfos.iterator(); i.hasNext(); )
         {
            DeliveryInfo del = (DeliveryInfo)i.next();
            DeliveryRecovery recInfo =
               new DeliveryRecovery(del.getMessageProxy().getDeliveryId(),
                                    del.getMessageProxy().getMessage().getMessageID(),
                                    del.getQueueName());

            recoveryInfos.add(recInfo);
         }

         log.debug(this + " sending delivery recovery " + recoveryInfos + " on failover");
View Full Code Here

     
      if (ackMode == Session.AUTO_ACKNOWLEDGE)
      {
         //Acknowledge or cancel any outstanding auto ack
        
         DeliveryInfo remainingAutoAck = state.getAutoAckInfo();
        
         if (remainingAutoAck != null)
         {
            if (trace) { log.trace(this + " handleClosing(). Found remaining auto ack. Will ack " + remainingAutoAck); }
           
View Full Code Here

      SessionState state = getState(invocation);
     
      int ackMode = state.getAcknowledgeMode();
     
      Object[] args = mi.getArguments();
      DeliveryInfo info = (DeliveryInfo)args[0];
     
      if (ackMode == Session.CLIENT_ACKNOWLEDGE)
      {
         // We collect acknowledgments in the list
        
         if (trace) { log.trace(this + " added to CLIENT_ACKNOWLEDGE list delivery " + info); }
        
         // Sanity check
         if (info.getConnectionConsumerSession() != null)
         {
            throw new IllegalStateException(
               "CLIENT_ACKNOWLEDGE cannot be used with a connection consumer");
         }
                 
         state.getClientAckList().add(info);
      }
      else if (ackMode == Session.AUTO_ACKNOWLEDGE)
      {
         // We collect the single acknowledgement in the state.
                          
         if (trace) { log.trace(this + " added " + info + " to session state"); }
        
         state.setAutoAckInfo(info);        
      }
      else if (ackMode == Session.DUPS_OK_ACKNOWLEDGE)
      {
         if (trace) { log.trace(this + " added to DUPS_OK_ACKNOWLEDGE list delivery " + info); }
        
         state.getClientAckList().add(info);
        
         //Also set here - this would be used for recovery in a message listener
         state.setAutoAckInfo(info);
      }
      else
      {            
         Object txID = state.getCurrentTxId();
  
         if (txID != null)
         {
            // 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);
View Full Code Here

         // It is possible that session.recover() is called inside a message listener onMessage
         // method - i.e. between the invocations of preDeliver and postDeliver. In this case we
         // don't want to acknowledge the last delivered messages - since it will be redelivered.
         if (!state.isRecoverCalled())
         {
            DeliveryInfo delivery = state.getAutoAckInfo();
           
            if (delivery == null)
            {
               throw new IllegalStateException("Cannot find delivery to AUTO_ACKNOWLEDGE");
            }
View Full Code Here

        
         del.redeliver(dels);
      }
      else if (ackMode == Session.AUTO_ACKNOWLEDGE || ackMode == Session.DUPS_OK_ACKNOWLEDGE)
      {
         DeliveryInfo info = state.getAutoAckInfo();
        
         //Don't recover if it's already to cancel
        
         if (info != null)
         {
View Full Code Here

      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
     
      // Need to be redelivered in reverse order.
      for (int i = toRedeliver.size() - 1; i >= 0; i--)
      {
         DeliveryInfo info = (DeliveryInfo)toRedeliver.get(i);
         MessageProxy proxy = info.getMessageProxy();       
        
         MessageCallbackHandler handler = state.getCallbackHandler(info.getConsumerId());
             
         if (handler == null)
         {
            // This is ok. The original consumer has closed, so we cancel the message
           
View Full Code Here

   {
      List cancels = new ArrayList();
     
      for (Iterator i = deliveryInfos.iterator(); i.hasNext(); )
      {
         DeliveryInfo ack = (DeliveryInfo)i.next();           
        
         DefaultCancel cancel = new DefaultCancel(ack.getMessageProxy().getDeliveryId(),
                                                  ack.getMessageProxy().getDeliveryCount(),
                                                  false, false);
        
         cancels.add(cancel);
     
     
View Full Code Here

            iter2 = acks.iterator();

            while (iter2.hasNext())
            {
               DeliveryInfo ack = (DeliveryInfo)iter2.next();

               //We only need the delivery id written
               out.writeLong(ack.getMessageProxy().getDeliveryId());
            }
         }
      }
   }
View Full Code Here

            serverID = newServerID;

            // Remove any non persistent acks
            for(Iterator i = acks.iterator(); i.hasNext(); )
            {
               DeliveryInfo di = (DeliveryInfo)i.next();

               if (!di.getMessageProxy().getMessage().isReliable())
               {
                  if (trace) { log.trace(this + " discarded non-persistent " + di + " on failover"); }
                  i.remove();
               }
            }
View Full Code Here

TOP

Related Classes of org.jboss.jms.server.endpoint.DeliveryInfo

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.