Package org.jboss.jms.client.state

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


      return consumerDelegate;
   }

   public Object handleClosing(Invocation invocation) throws Throwable
   {
      ConsumerState consumerState = getState(invocation);
      try
      {

         // We make sure closing is called on the ServerConsumerEndpoint.
         // This returns us the last delivery id sent

         Long l = (Long) invocation.invokeNext();

         long lastDeliveryId = l.longValue();

         // First we call close on the ClientConsumer which waits for onMessage invocations
         // to complete and the last delivery to arrive
         consumerState.getClientConsumer().close(lastDeliveryId);

         SessionState sessionState = (SessionState) consumerState.getParent();
         ConnectionState connectionState = (ConnectionState) sessionState.getParent();

         sessionState.removeCallbackHandler(consumerState.getClientConsumer());

         CallbackManager cm = connectionState.getRemotingConnection().getCallbackManager();
         cm.unregisterHandler(consumerState.getConsumerID());

         //And then we cancel any messages still in the message callback handler buffer
         consumerState.getClientConsumer().cancelBuffer();

         return l;

      }
      catch (Exception proxiedException)
      {
         ConnectionState connectionState = (ConnectionState) (consumerState.getParent().getParent());
         // if ServerPeer is shutdown or
         // if there is no failover in place... we just close the consumerState as well
         if (proxiedException instanceof MessagingShutdownException ||
                 (connectionState.getFailoverCommandCenter() == null))


         {
            if (!consumerState.getClientConsumer().isClosed())
            {
               consumerState.getClientConsumer().close(-1);
            }
         }
         throw proxiedException;
      }
View Full Code Here


      return (ConsumerState)((DelegateSupport)inv.getTargetObject()).getState();
   }
  
   private ClientConsumer getClientConsumer(Invocation inv)
   {     
      ConsumerState state = (ConsumerState)((DelegateSupport)inv.getTargetObject()).getState();
      return state.getClientConsumer();     
   }
View Full Code Here

TOP

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

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.