Package javax.jms

Examples of javax.jms.ServerSession


          ConsumerMessages cm = (ConsumerMessages) repliesIn.get();
          canStop = false;

          Vector msgs = cm.getMessages();
          int sessionMsgCounter = maxMsgs + 1;
          ServerSession serverSess = null;
          Session sess = null;
          for (int i = 0; i < msgs.size(); i++) {
            if (sessionMsgCounter > maxMsgs) {
              if (serverSess != null)
                serverSess.start();
              serverSess = sessPool.getServerSession();
              // This can hang if there is no more sessions
              // in the pool
              Object obj = serverSess.getSession();
              if (obj instanceof Session) {
                sess = (Session) obj;
              } else if (obj instanceof XASession) {
                sess = ((XASession) obj).sess;
              } else {
                throw new Error("Unexpected session type: " + obj);
              }
              sess.setMessageConsumerListener(MultiSessionConsumer.this);
              sessionMsgCounter = 1;
            }
            sess.onMessage((org.objectweb.joram.shared.messages.Message) msgs.get(i));
            sessionMsgCounter++;
          }
          serverSess.start();
          repliesIn.pop();
        }
      } catch (InterruptedException exc) {
        if (logger.isLoggable(BasicLevel.DEBUG)) {
          logger.log(BasicLevel.DEBUG, "", exc);
View Full Code Here


           
            if (!mesList.isEmpty())
            {
               if (trace) { log.trace("there are " + mesList.size() + " messages to send to session"); }

               ServerSession serverSession = serverSessionPool.getServerSession();
               JBossSession session = (JBossSession)serverSession.getSession();

               MessageListener listener = session.getMessageListener();

               if (listener == null)
               {
                  // Sanity check
                  if (trace) { log.trace(this + ": session " + session + " did not have a set MessageListener"); }
               }

               for (int i = 0; i < mesList.size(); i++)
               {
                  MessageProxy m = (MessageProxy)mesList.get(i);
                  session.addAsfMessage(m, consumerID, queueName, maxDeliveries, sess);
                  if (trace) { log.trace("added " + m + " to session"); }
               }

               if (trace) { log.trace(this + " starting serverSession " + serverSession); }

               serverSession.start();

               if (trace) { log.trace(this + "'s serverSession processed messages"); }

               mesList.clear();
            }           
View Full Code Here

      queueConnection.createConnectionConsumer(testQueue, null, new ServerSessionPool()
      {
         public ServerSession getServerSession()
         {
            Logger.getLogger(getClass().getName()).debug("Getting server session.");
            return new ServerSession()
            {
               public Session getSession()
               {
                  return session;
               }
View Full Code Here

      queueConnection.createConnectionConsumer(testQueue, null, new ServerSessionPool()
      {
         public ServerSession getServerSession()
         {
            Logger.getLogger(getClass().getName()).debug("Getting server session.");
            return new ServerSession()
            {
               public Session getSession()
               {
                  return session;
               }
View Full Code Here

   {
      boolean trace = log.isTraceEnabled();
      if (trace)
         log.trace("getServerSession");

      ServerSession result = null;
      boolean intr = false;
      try
      {
         synchronized (serverSessions)
         {
View Full Code Here

    public void dispatch(MessageDispatch messageDispatch) {
        try {
            messageDispatch.setConsumer(this);

            ServerSession serverSession = sessionPool.getServerSession();
            Session s = serverSession.getSession();
            ActiveMQSession session = null;

            if (s instanceof ActiveMQSession) {
                session = (ActiveMQSession)s;
            } else if (s instanceof ActiveMQTopicSession) {
                ActiveMQTopicSession topicSession = (ActiveMQTopicSession)s;
                session = (ActiveMQSession)topicSession.getNext();
            } else if (s instanceof ActiveMQQueueSession) {
                ActiveMQQueueSession queueSession = (ActiveMQQueueSession)s;
                session = (ActiveMQSession)queueSession.getNext();
            } else {
                connection.onAsyncException(new JMSException("Session pool provided an invalid session type: " + s.getClass()));
                return;
            }

            session.dispatch(messageDispatch);
            serverSession.start();
        } catch (JMSException e) {
            connection.onAsyncException(e);
        }
    }
View Full Code Here

        final CountDownLatch connectionConsumerGotOne = new CountDownLatch(1);
        final Session poolSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        connection.createConnectionConsumer(destination, null, new ServerSessionPool() {
            public ServerSession getServerSession() throws JMSException {
                return new ServerSession() {
                    public Session getSession() throws JMSException {
                        return poolSession;
                    }

                    public void start() throws JMSException {
View Full Code Here

           
            if (!mesList.isEmpty())
            {
               if (trace) { log.trace("there are " + mesList.size() + " messages to send to session"); }

               ServerSession serverSession = serverSessionPool.getServerSession();
               JBossSession session = (JBossSession)serverSession.getSession();

               MessageListener listener = session.getMessageListener();

               if (listener == null)
               {
                  // Sanity check
                  if (trace) { log.trace(this + ": session " + session + " did not have a set MessageListener"); }
               }

               for (int i = 0; i < mesList.size(); i++)
               {
                  MessageProxy m = (MessageProxy)mesList.get(i);
                  session.addAsfMessage(m, consumerID, queueName, maxDeliveries, sess, shouldAck);
                  if (trace) { log.trace("added " + m + " to session"); }
               }

               if (trace) { log.trace(this + " starting serverSession " + serverSession); }

               serverSession.start();

               if (trace) { log.trace(this + "'s serverSession processed messages"); }

               mesList.clear();
            }           
View Full Code Here

        final CountDownLatch connectionConsumerGotOne = new CountDownLatch(1);
        final Session poolSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        connection.createConnectionConsumer(destination, null, new ServerSessionPool() {
            public ServerSession getServerSession() throws JMSException {
                return new ServerSession() {
                    public Session getSession() throws JMSException {
                        return poolSession;
                    }

                    public void start() throws JMSException {
View Full Code Here

        final CountDownLatch connectionConsumerGotOne = new CountDownLatch(1);
        final Session poolSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        connection.createConnectionConsumer(destination, null, new ServerSessionPool() {
            public ServerSession getServerSession() throws JMSException {
                return new ServerSession() {
                    public Session getSession() throws JMSException {
                        return poolSession;
                    }

                    public void start() throws JMSException {
View Full Code Here

TOP

Related Classes of javax.jms.ServerSession

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.