Class JmsSession

    • Constructor Detail

      • JmsSession

        protected JmsSession​(JmsConnection connection,
                             JmsSessionId sessionId,
                             int acknowledgementMode)
                      throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
    • Method Detail

      • getAcknowledgeMode

        public int getAcknowledgeMode()
                               throws javax.jms.JMSException
        Specified by:
        getAcknowledgeMode in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • getTransacted

        public boolean getTransacted()
                              throws javax.jms.JMSException
        Specified by:
        getTransacted in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • getMessageListener

        public javax.jms.MessageListener getMessageListener()
                                                     throws javax.jms.JMSException
        Specified by:
        getMessageListener in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • setMessageListener

        public void setMessageListener​(javax.jms.MessageListener listener)
                                throws javax.jms.JMSException
        Specified by:
        setMessageListener in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • recover

        public void recover()
                     throws javax.jms.JMSException
        Specified by:
        recover in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • commit

        public void commit()
                    throws javax.jms.JMSException
        Specified by:
        commit in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • rollback

        public void rollback()
                      throws javax.jms.JMSException
        Specified by:
        rollback in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • close

        public void close()
                   throws javax.jms.JMSException
        Specified by:
        close in interface AutoCloseable
        Specified by:
        close in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • doClose

        protected void doClose()
                        throws javax.jms.JMSException
        Shutdown the Session and release all resources. Once completed the Session can request that the Provider destroy the Session and it's child resources.
        Throws:
        javax.jms.JMSException - if an internal error occurs during the close operation.
      • shutdown

        protected void shutdown()
                         throws javax.jms.JMSException
        This method should terminate all Session resources and prepare for disposal of the Session. It is called either from the Session close method or from the Connection when a close request is made and the Connection wants to cleanup all Session resources. This method should not attempt to send any requests to the Provider as the resources that were associated with this session are either cleaned up by another method in the session or are already gone due to remote close or some other error.
        Throws:
        javax.jms.JMSException - if an error occurs while shutting down the session resources.
      • shutdown

        protected boolean shutdown​(Throwable cause)
                            throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • createConsumer

        public javax.jms.MessageConsumer createConsumer​(javax.jms.Destination destination)
                                                 throws javax.jms.JMSException
        Specified by:
        createConsumer in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createConsumer(javax.jms.Destination)
      • createConsumer

        public javax.jms.MessageConsumer createConsumer​(javax.jms.Destination destination,
                                                        String messageSelector)
                                                 throws javax.jms.JMSException
        Specified by:
        createConsumer in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createConsumer(javax.jms.Destination, java.lang.String)
      • createConsumer

        public javax.jms.MessageConsumer createConsumer​(javax.jms.Destination destination,
                                                        String messageSelector,
                                                        boolean noLocal)
                                                 throws javax.jms.JMSException
        Specified by:
        createConsumer in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createConsumer(javax.jms.Destination, java.lang.String, boolean)
      • createReceiver

        public javax.jms.QueueReceiver createReceiver​(javax.jms.Queue queue)
                                               throws javax.jms.JMSException
        Specified by:
        createReceiver in interface javax.jms.QueueSession
        Throws:
        javax.jms.JMSException
        See Also:
        QueueSession.createReceiver(javax.jms.Queue)
      • createReceiver

        public javax.jms.QueueReceiver createReceiver​(javax.jms.Queue queue,
                                                      String messageSelector)
                                               throws javax.jms.JMSException
        Specified by:
        createReceiver in interface javax.jms.QueueSession
        Throws:
        javax.jms.JMSException
        See Also:
        QueueSession.createReceiver(javax.jms.Queue, java.lang.String)
      • createBrowser

        public javax.jms.QueueBrowser createBrowser​(javax.jms.Queue destination)
                                             throws javax.jms.JMSException
        Specified by:
        createBrowser in interface javax.jms.QueueSession
        Specified by:
        createBrowser in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createBrowser(javax.jms.Queue)
      • createBrowser

        public javax.jms.QueueBrowser createBrowser​(javax.jms.Queue destination,
                                                    String messageSelector)
                                             throws javax.jms.JMSException
        Specified by:
        createBrowser in interface javax.jms.QueueSession
        Specified by:
        createBrowser in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createBrowser(javax.jms.Queue, java.lang.String)
      • createSubscriber

        public javax.jms.TopicSubscriber createSubscriber​(javax.jms.Topic topic)
                                                   throws javax.jms.JMSException
        Specified by:
        createSubscriber in interface javax.jms.TopicSession
        Throws:
        javax.jms.JMSException
        See Also:
        TopicSession.createSubscriber(javax.jms.Topic)
      • createSubscriber

        public javax.jms.TopicSubscriber createSubscriber​(javax.jms.Topic topic,
                                                          String messageSelector,
                                                          boolean noLocal)
                                                   throws javax.jms.JMSException
        Specified by:
        createSubscriber in interface javax.jms.TopicSession
        Throws:
        javax.jms.JMSException
        See Also:
        TopicSession.createSubscriber(javax.jms.Topic, java.lang.String, boolean)
      • createDurableSubscriber

        public javax.jms.TopicSubscriber createDurableSubscriber​(javax.jms.Topic topic,
                                                                 String name)
                                                          throws javax.jms.JMSException
        Specified by:
        createDurableSubscriber in interface javax.jms.Session
        Specified by:
        createDurableSubscriber in interface javax.jms.TopicSession
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createDurableSubscriber(javax.jms.Topic, java.lang.String)
      • createDurableSubscriber

        public javax.jms.TopicSubscriber createDurableSubscriber​(javax.jms.Topic topic,
                                                                 String name,
                                                                 String messageSelector,
                                                                 boolean noLocal)
                                                          throws javax.jms.JMSException
        Specified by:
        createDurableSubscriber in interface javax.jms.Session
        Specified by:
        createDurableSubscriber in interface javax.jms.TopicSession
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createDurableSubscriber(javax.jms.Topic, java.lang.String, java.lang.String, boolean)
      • createDurableConsumer

        public javax.jms.MessageConsumer createDurableConsumer​(javax.jms.Topic topic,
                                                               String name)
                                                        throws javax.jms.JMSException
        Specified by:
        createDurableConsumer in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createDurableConsumer(javax.jms.Topic, java.lang.String)
      • createDurableConsumer

        public javax.jms.MessageConsumer createDurableConsumer​(javax.jms.Topic topic,
                                                               String name,
                                                               String messageSelector,
                                                               boolean noLocal)
                                                        throws javax.jms.JMSException
        Specified by:
        createDurableConsumer in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createDurableConsumer(javax.jms.Topic, java.lang.String, java.lang.String, boolean)
      • checkClientIDWasSetExplicitly

        protected void checkClientIDWasSetExplicitly()
                                              throws javax.jms.IllegalStateException
        Throws:
        javax.jms.IllegalStateException
      • unsubscribe

        public void unsubscribe​(String name)
                         throws javax.jms.JMSException
        Specified by:
        unsubscribe in interface javax.jms.Session
        Specified by:
        unsubscribe in interface javax.jms.TopicSession
        Throws:
        javax.jms.JMSException
        See Also:
        Session.unsubscribe(java.lang.String)
      • createSharedConsumer

        public javax.jms.MessageConsumer createSharedConsumer​(javax.jms.Topic topic,
                                                              String name)
                                                       throws javax.jms.JMSException
        Specified by:
        createSharedConsumer in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createSharedConsumer(javax.jms.Topic, java.lang.String)
      • createSharedConsumer

        public javax.jms.MessageConsumer createSharedConsumer​(javax.jms.Topic topic,
                                                              String name,
                                                              String selector)
                                                       throws javax.jms.JMSException
        Specified by:
        createSharedConsumer in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createSharedConsumer(javax.jms.Topic, java.lang.String, java.lang.String)
      • createSharedDurableConsumer

        public javax.jms.MessageConsumer createSharedDurableConsumer​(javax.jms.Topic topic,
                                                                     String name)
                                                              throws javax.jms.JMSException
        Specified by:
        createSharedDurableConsumer in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createSharedDurableConsumer(javax.jms.Topic, java.lang.String)
      • createSharedDurableConsumer

        public javax.jms.MessageConsumer createSharedDurableConsumer​(javax.jms.Topic topic,
                                                                     String name,
                                                                     String selector)
                                                              throws javax.jms.JMSException
        Specified by:
        createSharedDurableConsumer in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createSharedDurableConsumer(javax.jms.Topic, java.lang.String, java.lang.String)
      • createProducer

        public javax.jms.MessageProducer createProducer​(javax.jms.Destination destination)
                                                 throws javax.jms.JMSException
        Specified by:
        createProducer in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createProducer(javax.jms.Destination)
      • createSender

        public javax.jms.QueueSender createSender​(javax.jms.Queue queue)
                                           throws javax.jms.JMSException
        Specified by:
        createSender in interface javax.jms.QueueSession
        Throws:
        javax.jms.JMSException
        See Also:
        QueueSession.createSender(javax.jms.Queue)
      • createPublisher

        public javax.jms.TopicPublisher createPublisher​(javax.jms.Topic topic)
                                                 throws javax.jms.JMSException
        Specified by:
        createPublisher in interface javax.jms.TopicSession
        Throws:
        javax.jms.JMSException
        See Also:
        TopicSession.createPublisher(javax.jms.Topic)
      • createBytesMessage

        public javax.jms.BytesMessage createBytesMessage()
                                                  throws javax.jms.JMSException
        Specified by:
        createBytesMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • createMapMessage

        public javax.jms.MapMessage createMapMessage()
                                              throws javax.jms.JMSException
        Specified by:
        createMapMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • createMessage

        public javax.jms.Message createMessage()
                                        throws javax.jms.JMSException
        Specified by:
        createMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • createObjectMessage

        public javax.jms.ObjectMessage createObjectMessage()
                                                    throws javax.jms.JMSException
        Specified by:
        createObjectMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • createObjectMessage

        public javax.jms.ObjectMessage createObjectMessage​(Serializable object)
                                                    throws javax.jms.JMSException
        Specified by:
        createObjectMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • createStreamMessage

        public javax.jms.StreamMessage createStreamMessage()
                                                    throws javax.jms.JMSException
        Specified by:
        createStreamMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • createTextMessage

        public javax.jms.TextMessage createTextMessage()
                                                throws javax.jms.JMSException
        Specified by:
        createTextMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • createTextMessage

        public javax.jms.TextMessage createTextMessage​(String text)
                                                throws javax.jms.JMSException
        Specified by:
        createTextMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
      • createQueue

        public javax.jms.Queue createQueue​(String queueName)
                                    throws javax.jms.JMSException
        Specified by:
        createQueue in interface javax.jms.QueueSession
        Specified by:
        createQueue in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createQueue(java.lang.String)
      • createTopic

        public javax.jms.Topic createTopic​(String topicName)
                                    throws javax.jms.JMSException
        Specified by:
        createTopic in interface javax.jms.Session
        Specified by:
        createTopic in interface javax.jms.TopicSession
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createTopic(java.lang.String)
      • createTemporaryQueue

        public javax.jms.TemporaryQueue createTemporaryQueue()
                                                      throws javax.jms.JMSException
        Specified by:
        createTemporaryQueue in interface javax.jms.QueueSession
        Specified by:
        createTemporaryQueue in interface javax.jms.Session
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createTemporaryQueue()
      • createTemporaryTopic

        public javax.jms.TemporaryTopic createTemporaryTopic()
                                                      throws javax.jms.JMSException
        Specified by:
        createTemporaryTopic in interface javax.jms.Session
        Specified by:
        createTemporaryTopic in interface javax.jms.TopicSession
        Throws:
        javax.jms.JMSException
        See Also:
        Session.createTemporaryTopic()
      • run

        public void run()
        Specified by:
        run in interface Runnable
        Specified by:
        run in interface javax.jms.Session
      • onException

        protected void onException​(Exception ex)
      • send

        protected void send​(JmsMessageProducer producer,
                            javax.jms.Destination dest,
                            javax.jms.Message msg,
                            int deliveryMode,
                            int priority,
                            long timeToLive,
                            boolean disableMsgId,
                            boolean disableTimestamp,
                            long deliveryDelay,
                            javax.jms.CompletionListener listener)
                     throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • isClosed

        public boolean isClosed()
      • isTransacted

        public boolean isTransacted()
        Checks whether the session uses transactions.
        Returns:
        true if the session uses transactions.
      • isClientAcknowledge

        public boolean isClientAcknowledge()
        Checks whether the session used client acknowledgment.
        Returns:
        true if the session uses client acknowledgment.
      • isAutoAcknowledge

        public boolean isAutoAcknowledge()
        Checks whether the session used auto acknowledgment.
        Returns:
        true if the session uses client acknowledgment.
      • isDupsOkAcknowledge

        public boolean isDupsOkAcknowledge()
        Checks whether the session used dup ok acknowledgment.
        Returns:
        true if the session uses client acknowledgment.
      • isNoAcknowledge

        public boolean isNoAcknowledge()
        Checks whether the session uses presettlement for all consumers.
        Returns:
        true if the session is using a presettlement for consumers.
      • isIndividualAcknowledge

        public boolean isIndividualAcknowledge()
        Checks whether the session used individual acknowledgment mode.
        Returns:
        true if the session uses individual acknowledgment.
      • checkClosed

        protected void checkClosed()
                            throws javax.jms.IllegalStateException
        Throws:
        javax.jms.IllegalStateException
      • checkDestination

        public static void checkDestination​(javax.jms.Destination dest)
                                     throws javax.jms.InvalidDestinationException
        Throws:
        javax.jms.InvalidDestinationException
      • start

        protected void start()
                      throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • stop

        protected void stop()
                     throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • isStarted

        protected boolean isStarted()
      • getSessionMode

        protected int getSessionMode()
      • getNextConsumerId

        protected JmsConsumerId getNextConsumerId()
      • getNextProducerId

        protected JmsProducerId getNextProducerId()
      • setTransactionContext

        public void setTransactionContext​(JmsTransactionContext transactionContext)
        Sets the transaction context of the session.
        Parameters:
        transactionContext - provides the means to control a JMS transaction.
      • getTransactionContext

        public JmsTransactionContext getTransactionContext()
        Returns the transaction context of the session.
        Returns:
        transactionContext session's transaction context.
      • onConnectionInterrupted

        protected void onConnectionInterrupted()
      • onConnectionRestored

        protected void onConnectionRestored()