Package org.jboss.jms.delegate

Examples of org.jboss.jms.delegate.SessionDelegate


      if (trace) { log.trace("run()"); }
     
      MethodInvocation mi = (MethodInvocation)invocation;
           
      //This is the delegate for the session from the pool
      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
     
      SessionState state = getState(invocation);
     
      int ackMode = state.getAcknowledgeMode();
View Full Code Here


  
   private boolean ackDelivery(SessionDelegate sess, DeliveryInfo delivery) throws Exception
   {
     if (delivery.isShouldAck())
     {
        SessionDelegate connectionConsumerSession = delivery.getConnectionConsumerSession();
       
        //If the delivery was obtained via a connection consumer we need to ack via that
        //otherwise we just use this session
       
        SessionDelegate sessionToUse = connectionConsumerSession != null ? connectionConsumerSession : sess;
       
        return sessionToUse.acknowledgeDelivery(delivery);
     }
     else
     {
       return true;
     }
View Full Code Here

  
   private void cancelDelivery(SessionDelegate sess, DeliveryInfo delivery) throws Exception
   {
     if (delivery.isShouldAck())
     {
        SessionDelegate connectionConsumerSession = delivery.getConnectionConsumerSession();
       
        //If the delivery was obtained via a connection consumer we need to cancel via that
        //otherwise we just use this session
       
        SessionDelegate sessionToUse = connectionConsumerSession != null ? connectionConsumerSession : sess;
       
        sessionToUse.cancelDelivery(new DefaultCancel(delivery.getDeliveryID(),
                                    delivery.getMessageProxy().getDeliveryCount(), false, false));     
     }
   }
View Full Code Here

      return;
    }
   
    if (trace) { log.trace(this + " starting"); }
               
    SessionDelegate localdel = ((JBossSession)localSession).getDelegate();
   
    producer = localdel.createProducerDelegate(jbq);
   
    //We create the consumer with autoFlowControl = false
    //In this mode, the consumer does not handle it's own flow control, but it must be handled
    //manually using changeRate() methods
    //The local queue itself will manually send these messages depending on its state -
    //So effectively the message buffering is handled by the local queue, not the ClientConsumer
   
    SessionDelegate sourcedel = ((JBossSession)sourceSession).getDelegate();
   
    consumer = (ClientConsumerDelegate)sourcedel.createConsumerDelegate(jbq, null, false, null, false, false);
   
    clientConsumer = ((ConsumerState)consumer.getState()).getClientConsumer();
               
    consumer.setMessageListener(this);   
   
View Full Code Here

        try
        {
            if (session instanceof JBossSession)
            {
                final JBossSession jbossSession = (JBossSession)session ;
                final SessionDelegate sessionDelegate = jbossSession.getDelegate() ;
                if (sessionDelegate instanceof ClientSessionDelegate)
                {
                    final ClientSessionDelegate clientSessionDelegate = (ClientSessionDelegate)sessionDelegate ;
                    final HierarchicalState state = clientSessionDelegate.getState() ;
                    if (state instanceof SessionState)
View Full Code Here

  
   public Object handleClosing(Invocation invocation) throws Throwable
   {
      MethodInvocation mi = (MethodInvocation)invocation;
      SessionState state = getState(invocation);
      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
           
      if (trace) { log.trace("handleClosing()"); }

      //Sanity check
      if (state.isXA() && !isXAAndConsideredNonTransacted(state))
View Full Code Here

      MethodInvocation mi = (MethodInvocation)invocation;
      SessionState state = getState(invocation);
     
      int ackMode = state.getAcknowledgeMode();
     
      SessionDelegate sd = (SessionDelegate)mi.getTargetObject();
     
      boolean res = true;

      // if XA and there is no transaction enlisted on XA we will act as AutoAcknowledge
      // However if it's a MDB (if there is a DistinguishedListener) we should behaved as transacted
View Full Code Here

    */
   public Object handleAcknowledgeAll(Invocation invocation) throws Throwable
   {   
      MethodInvocation mi = (MethodInvocation)invocation;
      SessionState state = getState(invocation);
      SessionDelegate del = (SessionDelegate)mi.getTargetObject();           
   
      if (!state.getClientAckList().isEmpty())
      {                
         //CLIENT_ACKNOWLEDGE can't be used with a MDB so it is safe to always acknowledge all
         //on this session (rather than the connection consumer session)
View Full Code Here

      }
     
      if (trace) { log.trace("recovering the session"); }
      
      //Call redeliver
      SessionDelegate del = (SessionDelegate)mi.getTargetObject();
     
      int ackMode = state.getAcknowledgeMode();
     
      if (ackMode == Session.CLIENT_ACKNOWLEDGE)
      {
         List dels = state.getClientAckList();
        
         state.setClientAckList(new ArrayList());
        
         del.redeliver(dels);

         state.setRecoverCalled(true);
      }
      else if (ackMode == Session.AUTO_ACKNOWLEDGE || ackMode == Session.DUPS_OK_ACKNOWLEDGE || isXAAndConsideredNonTransacted(state))
      {
         DeliveryInfo info = state.getAutoAckInfo();
        
         //Don't recover if it's already to cancel
        
         if (info != null)
         {
            List redels = new ArrayList();
           
            redels.add(info);
           
            del.redeliver(redels);
           
            state.setAutoAckInfo(null);           

            state.setRecoverCalled(true);
         }
View Full Code Here

     
      List toRedeliver = (List)mi.getArguments()[0];
      
      if (trace) { log.trace(this + " handleRedeliver() called: " + toRedeliver); }
     
      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);
View Full Code Here

TOP

Related Classes of org.jboss.jms.delegate.SessionDelegate

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.