Class WmSessionImpl

  • All Implemented Interfaces:
    WmSession, java.lang.Runnable, javax.jms.Session
    Direct Known Subclasses:
    WmClusterSessionImpl, WmQueueSessionImpl, WmTopicSessionImpl, WmXASessionImpl

    public class WmSessionImpl
    extends Node
    implements WmSession
    This implementation need not be thread safe, which means the assumption of only 1 user thread ever in this class holds good.However, care should be taken that when connection.close() is called, the session.close() is called only when the session is done with its inflight job.
    • Field Detail

      • _currentAsyncMessage

        protected volatile WmMessageImpl _currentAsyncMessage
      • _isXA

        protected boolean _isXA
      • _logApi

        protected boolean _logApi
      • _transacted

        protected boolean _transacted
      • _closed

        protected volatile boolean _closed
      • _closeInProgress

        protected volatile boolean _closeInProgress
      • _transactionID

        protected volatile long _transactionID
      • DEFAULT_TRANSACTION_TIMEOUT

        public static final int DEFAULT_TRANSACTION_TIMEOUT
        See Also:
        Constant Field Values
      • _transactionTimeout

        protected int _transactionTimeout
      • _xid

        protected volatile WmXid _xid
      • _sessionDispatcherCount

        protected int _sessionDispatcherCount
      • _messageListener

        protected javax.jms.MessageListener _messageListener
      • _sessionSubscriberMessageConsumers

        protected java.util.Vector<WmMessageConsumer> _sessionSubscriberMessageConsumers
      • _acknowledgeMode

        protected int _acknowledgeMode
      • _sessionReconnect

        protected boolean _sessionReconnect
      • brokerName

        protected java.lang.String brokerName
    • Constructor Detail

      • WmSessionImpl

        protected WmSessionImpl​(WmConnectionImpl connection,
                                boolean transacted,
                                boolean isXA,
                                int acknowledgeMode)
                         throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • WmSessionImpl

        protected WmSessionImpl​(WmConnectionImpl connection)
        Default constructor for subclasses.
    • Method Detail

      • setMessageQueue

        public void setMessageQueue​(WmSessionQueue queue)
        Added to change the implementation of the WmSessionQueue to the WmClusterSessionQueueImpl incase of cluster sessions
        Parameters:
        queue -
      • createBytesMessage

        public javax.jms.BytesMessage createBytesMessage()
                                                  throws javax.jms.JMSException
        Creates a BytesMessage object. A BytesMessage object is used to send a message containing a stream of uninterpreted bytes.
        Specified by:
        createBytesMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.
      • createMapMessage

        public javax.jms.MapMessage createMapMessage()
                                              throws javax.jms.JMSException
        Creates a MapMessage object. A MapMessage object is used to send a self-defining set of name-value pairs, where names are String objects and values are primitive values in the Java programming language.
        Specified by:
        createMapMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.
      • createMessage

        public javax.jms.Message createMessage()
                                        throws javax.jms.JMSException
        Creates a Message object. The Message interface is the root interface of all JMS messages. A Message object holds all the standard message header information. It can be sent when a message containing only header information is sufficient.
        Specified by:
        createMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.
      • createObjectMessage

        public javax.jms.ObjectMessage createObjectMessage()
                                                    throws javax.jms.JMSException
        Creates an ObjectMessage object. An ObjectMessage object is used to send a message that contains a serializable Java object.
        Specified by:
        createObjectMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.
      • createObjectMessage

        public javax.jms.ObjectMessage createObjectMessage​(java.io.Serializable object)
                                                    throws javax.jms.JMSException
        Creates an initialized ObjectMessage object. An ObjectMessage object is used to send a message that contains a serializable Java object.
        Specified by:
        createObjectMessage in interface javax.jms.Session
        Parameters:
        object - the object to use to initialize this message
        Throws:
        javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.
      • createStreamMessage

        public javax.jms.StreamMessage createStreamMessage()
                                                    throws javax.jms.JMSException
        Creates a StreamMessage object. A StreamMessage object is used to send a self-defining stream of primitive values in the Java programming language.
        Specified by:
        createStreamMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.
      • createTextMessage

        public javax.jms.TextMessage createTextMessage()
                                                throws javax.jms.JMSException
        Creates a TextMessage object. A TextMessage object is used to send a message containing a String object.
        Specified by:
        createTextMessage in interface javax.jms.Session
        Throws:
        javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.
      • createTextMessage

        public javax.jms.TextMessage createTextMessage​(java.lang.String text)
                                                throws javax.jms.JMSException
        Creates an initialized TextMessage object. A TextMessage object is used to send a message containing a String.
        Specified by:
        createTextMessage in interface javax.jms.Session
        Parameters:
        text - the string used to initialize this message
        Throws:
        javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.
      • getTransacted

        public boolean getTransacted()
                              throws javax.jms.JMSException
        Indicates whether the session is in transacted mode.
        Specified by:
        getTransacted in interface javax.jms.Session
        Returns:
        true if the session is in transacted mode
        Throws:
        javax.jms.JMSException - if the JMS provider fails to return the transaction mode due to some internal error.
      • getAcknowledgeMode

        public int getAcknowledgeMode()
                               throws javax.jms.JMSException
        Returns the acknowledgement mode of the session. The acknowledgement mode is set at the time that the session is created. If the session is transacted, the acknowledgement mode is ignored.
        Specified by:
        getAcknowledgeMode in interface javax.jms.Session
        Returns:
        If the session is not transacted, returns the current acknowledgement mode for the session. If the session is transacted, returns SESSION_TRANSACTED.
        Throws:
        javax.jms.JMSException - if the JMS provider fails to return the acknowledgment mode due to some internal error.
      • commit

        public void commit()
                    throws javax.jms.JMSException
        Commits all messages done in this transaction and releases any locks currently held.
        Specified by:
        commit in interface javax.jms.Session
        Throws:
        javax.jms.JMSException - if the JMS provider fails to commit the transaction due to some internal error.
        javax.jms.TransactionRolledBackException - if the transaction is rolled back due to some internal error during commit.
        javax.jms.IllegalStateException - if the method is not called by a transacted session.
      • prepare

        public int prepare​(long xid)
                    throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • prepare

        public int prepare​(long xid,
                           boolean isCluster)
                    throws javax.jms.JMSException
        Prepare Transaction for Cluster
        Parameters:
        xid -
        isCluster -
        Throws:
        javax.jms.JMSException
      • rollback

        public void rollback()
                      throws javax.jms.JMSException
        Rolls back any messages done in this transaction and releases any locks currently held.
        Specified by:
        rollback in interface javax.jms.Session
        Throws:
        javax.jms.JMSException - if the JMS provider fails to roll back the transaction due to some internal error.
        javax.jms.IllegalStateException - if the method is not called by a transacted session.
      • close

        public void close()
                   throws javax.jms.JMSException
        Closes the session.

        Since a provider may allocate some resources on behalf of a session outside the JVM, clients should close the resources when they are not needed. Relying on garbage collection to eventually reclaim these resources may not be timely enough.

        There is no need to close the producers and consumers of a closed session.

        This call will block until a receive call or message listener in progress has completed. A blocked message consumer receive call returns null when this session is closed.

        Closing a transacted session must roll back the transaction in progress.

        This method is the only Session method that can be called concurrently.

        Invoking any other Session method on a closed session must throw a JMSException.IllegalStateException. Closing a closed session must not throw an exception.

        Specified by:
        close in interface javax.jms.Session
        Throws:
        javax.jms.JMSException - if the JMS provider fails to close the session due to some internal error.
      • recover

        public void recover()
                     throws javax.jms.JMSException
        Stops message delivery in this session, and restarts message delivery with the oldest unacknowledged message.

        All consumers deliver messages in a serial order. Acknowledging a received message automatically acknowledges all messages that have been delivered to the client.

        Restarting a session causes it to take the following actions:

        • Stop message delivery
        • Mark all messages that might have been delivered but not acknowledged as "redelivered"
        • Restart the delivery sequence including all unacknowledged messages that had been previously delivered. Redelivered messages do not have to be delivered in exactly their original delivery order.
        Specified by:
        recover in interface javax.jms.Session
        Throws:
        javax.jms.JMSException - if the JMS provider fails to stop and restart message delivery due to some internal error.
        javax.jms.IllegalStateException - if the method is called by a transacted session.
      • recoverInternal

        public void recoverInternal​(boolean recoverFromSessionDispatcher)
                             throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • getMessageListener

        public javax.jms.MessageListener getMessageListener()
                                                     throws javax.jms.JMSException
        Returns the session's distinguished message listener (optional).
        Specified by:
        getMessageListener in interface javax.jms.Session
        Returns:
        the message listener associated with this session
        Throws:
        javax.jms.JMSException - if the JMS provider fails to get the message listener due to an internal error.
      • setMessageListener

        public void setMessageListener​(javax.jms.MessageListener listener)
                                throws javax.jms.JMSException
        Sets the session's distinguished message listener (optional).

        When the distinguished message listener is set, no other form of message receipt in the session can be used; however, all forms of sending messages are still supported.

        This is an expert facility not used by regular JMS clients.

        Specified by:
        setMessageListener in interface javax.jms.Session
        Parameters:
        listener - the message listener to associate with this session
        Throws:
        javax.jms.JMSException - if the JMS provider fails to set the message listener due to an internal error.
      • run

        public void run()
        Optional operation, intended to be used only by Application Servers, not by ordinary JMS clients.
        Specified by:
        run in interface java.lang.Runnable
        Specified by:
        run in interface javax.jms.Session
      • createProducer

        public javax.jms.MessageProducer createProducer​(javax.jms.Destination destination)
                                                 throws javax.jms.JMSException
        Creates a MessageProducer to send messages to the specified destination.

        A client uses a MessageProducer object to send messages to a destination. Since Queue and Topic both inherit from Destination, they can be used in the destination parameter to create a MessageProducer object.

        Specified by:
        createProducer in interface javax.jms.Session
        Parameters:
        destination - the Destination to send to, or null if this is a producer which does not have a specified destination.
        Throws:
        javax.jms.JMSException - if the session fails to create a MessageProducer due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid destination is specified.
      • createSender

        public javax.jms.QueueSender createSender​(javax.jms.Queue queue)
                                           throws javax.jms.JMSException
        Creates a QueueSender object to send messages to the specified queue.
        Parameters:
        queue - the Queue to access, or null if this is an unidentified producer
        Throws:
        javax.jms.JMSException - if the session fails to create a sender due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid queue is specified.
      • createPublisher

        public javax.jms.TopicPublisher createPublisher​(javax.jms.Topic topic)
                                                 throws javax.jms.JMSException
        Creates a publisher for the specified topic.

        A client uses a TopicPublisher object to publish messages on a topic. Each time a client creates a TopicPublisher on a topic, it defines a new sequence of messages that have no ordering relationship with the messages it has previously sent.

        Parameters:
        topic - the Topic to publish to, or null if this is an unidentified producer
        Throws:
        javax.jms.JMSException - if the session fails to create a publisher due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid topic is specified.
      • createConsumer

        public javax.jms.MessageConsumer createConsumer​(javax.jms.Destination destination)
                                                 throws javax.jms.JMSException
        Creates a MessageConsumer for the specified destination. Since Queue and Topic both inherit from Destination, they can be used in the destination parameter to create a MessageConsumer.
        Specified by:
        createConsumer in interface javax.jms.Session
        Parameters:
        destination - the Destination to access.
        Throws:
        javax.jms.JMSException - if the session fails to create a consumer due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid destination is specified.
      • createConsumer

        public javax.jms.MessageConsumer createConsumer​(javax.jms.Destination destination,
                                                        java.lang.String messageSelector)
                                                 throws javax.jms.JMSException
        Creates a MessageConsumer for the specified destination, using a message selector. Since Queue and Topic both inherit from Destination, they can be used in the destination parameter to create a MessageConsumer.

        A client uses a MessageConsumer object to receive messages that have been sent to a destination.

        Specified by:
        createConsumer in interface javax.jms.Session
        Parameters:
        destination - the Destination to access
        messageSelector - only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.
        Throws:
        javax.jms.JMSException - if the session fails to create a MessageConsumer due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid destination is specified.
        javax.jms.InvalidSelectorException - if the message selector is invalid.
      • createConsumer

        public javax.jms.MessageConsumer createConsumer​(javax.jms.Destination destination,
                                                        java.lang.String messageSelector,
                                                        boolean noLocal)
                                                 throws javax.jms.JMSException
        Creates MessageConsumer for the specified destination, using a message selector. This method can specify whether messages published by its own connection should be delivered to it, if the destination is a topic.

        Since Queue and Topic both inherit from Destination, they can be used in the destination parameter to create a MessageConsumer.

        A client uses a MessageConsumer object to receive messages that have been published to a destination.

        In some cases, a connection may both publish and subscribe to a topic. The consumer noLocal attribute allows a consumer to inhibit the delivery of messages published by its own connection. The default value for this attribute is False. The noLocal value must be supported by destinations that are topics.

        Specified by:
        createConsumer in interface javax.jms.Session
        Parameters:
        destination - the Destination to access
        messageSelector - only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.
        noLocal - - if true, and the destination is a topic, inhibits the delivery of messages published by its own connection. The behavior for noLocal is not specified if the destination is a queue.
        Throws:
        javax.jms.JMSException - if the session fails to create a MessageConsumer due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid destination is specified.
        javax.jms.InvalidSelectorException - if the message selector is invalid.
      • createQueue

        public javax.jms.Queue createQueue​(java.lang.String queueName)
                                    throws javax.jms.JMSException
        Creates a queue identity given a Queue name.

        This facility is provided for the rare cases where clients need to dynamically manipulate queue identity. It allows the creation of a queue identity with a provider-specific name. Clients that depend on this ability are not portable.

        Note that this method is not for creating the physical queue. The physical creation of queues is an administrative task and is not to be initiated by the JMS API. The one exception is the creation of temporary queues, which is accomplished with the createTemporaryQueue method.

        Specified by:
        createQueue in interface javax.jms.Session
        Parameters:
        queueName - the name of this Queue
        Returns:
        a Queue with the given name
        Throws:
        javax.jms.JMSException - if the session fails to create a queue due to some internal error.
      • createTopic

        public javax.jms.Topic createTopic​(java.lang.String topicName)
                                    throws javax.jms.JMSException
        Creates a topic identity given a Topic name.

        This facility is provided for the rare cases where clients need to dynamically manipulate topic identity. This allows the creation of a topic identity with a provider-specific name. Clients that depend on this ability are not portable.

        Note that this method is not for creating the physical topic. The physical creation of topics is an administrative task and is not to be initiated by the JMS API. The one exception is the creation of temporary topics, which is accomplished with the createTemporaryTopic method.

        Specified by:
        createTopic in interface javax.jms.Session
        Parameters:
        topicName - the name of this Topic
        Returns:
        a Topic with the given name
        Throws:
        javax.jms.JMSException - if the session fails to create a topic due to some internal error.
      • createSubscriber

        public javax.jms.TopicSubscriber createSubscriber​(javax.jms.Topic topic)
                                                   throws javax.jms.JMSException
        Creates a nondurable subscriber to the specified topic.

        A client uses a TopicSubscriber object to receive messages that have been published to a topic.

        Regular TopicSubscriber objects are not durable. They receive only messages that are published while they are active.

        In some cases, a connection may both publish and subscribe to a topic. The subscriber NoLocal attribute allows a subscriber to inhibit the delivery of messages published by its own connection. The default value for this attribute is false.

        Parameters:
        topic - the Topic to subscribe to
        Throws:
        javax.jms.JMSException - if the session fails to create a subscriber due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid topic is specified.
      • createSubscriber

        public javax.jms.TopicSubscriber createSubscriber​(javax.jms.Topic topic,
                                                          java.lang.String messageSelector,
                                                          boolean noLocal)
                                                   throws javax.jms.JMSException
        Creates a nondurable subscriber to the specified topic, using a message selector or specifying whether messages published by its own connection should be delivered to it.

        A client uses a TopicSubscriber object to receive messages that have been published to a topic.

        Regular TopicSubscriber objects are not durable. They receive only messages that are published while they are active.

        Messages filtered out by a subscriber's message selector will never be delivered to the subscriber. From the subscriber's perspective, they do not exist.

        In some cases, a connection may both publish and subscribe to a topic. The subscriber NoLocal attribute allows a subscriber to inhibit the delivery of messages published by its own connection. The default value for this attribute is false.

        Parameters:
        topic - the Topic to subscribe to
        messageSelector - only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.
        noLocal - if set, inhibits the delivery of messages published by its own connection
        Throws:
        javax.jms.JMSException - if the session fails to create a subscriber due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid topic is specified.
        javax.jms.InvalidSelectorException - if the message selector is invalid.
      • createDurableSubscriber

        public javax.jms.TopicSubscriber createDurableSubscriber​(javax.jms.Topic topic,
                                                                 java.lang.String name)
                                                          throws javax.jms.JMSException
        Creates a durable subscriber to the specified topic.

        If a client needs to receive all the messages published on a topic, including the ones published while the subscriber is inactive, it uses a durable TopicSubscriber. The JMS provider retains a record of this durable subscription and insures that all messages from the topic's publishers are retained until they are acknowledged by this durable subscriber or they have expired.

        Sessions with durable subscribers must always provide the same client identifier. In addition, each client must specify a name that uniquely identifies (within client identifier) each durable subscription it creates. Only one session at a time can have a TopicSubscriber for a particular durable subscription.

        A client can change an existing durable subscription by creating a durable TopicSubscriber with the same name and a new topic and/or message selector. Changing a durable subscriber is equivalent to unsubscribing (deleting) the old one and creating a new one.

        In some cases, a connection may both publish and subscribe to a topic. The subscriber noLocal attribute allows a subscriber to inhibit the delivery of messages published by its own connection. The default value for this attribute is false.

        Specified by:
        createDurableSubscriber in interface javax.jms.Session
        Parameters:
        topic - the non-temporary Topic to subscribe to
        name - the name used to identify this subscription
        Throws:
        javax.jms.JMSException - if the session fails to create a subscriber due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid topic is specified.
      • createDurableSubscriber

        public javax.jms.TopicSubscriber createDurableSubscriber​(javax.jms.Topic topic,
                                                                 java.lang.String name,
                                                                 java.lang.String messageSelector,
                                                                 boolean noLocal)
                                                          throws javax.jms.JMSException
        Creates a durable subscriber to the specified topic, using a message selector and specifying whether messages published by its own connection should be delivered to it.

        If a client needs to receive all the messages published on a topic, including the ones published while the subscriber is inactive, it uses a durable TopicSubscriber. The JMS provider retains a record of this durable subscription and insures that all messages from the topic's publishers are retained until they are acknowledged by this durable subscriber or they have expired.

        Sessions with durable subscribers must always provide the same client identifier. In addition, each client must specify a name which uniquely identifies (within client identifier) each durable subscription it creates. Only one session at a time can have a TopicSubscriber for a particular durable subscription. An inactive durable subscriber is one that exists but does not currently have a message consumer associated with it.

        A client can change an existing durable subscription by creating a durable TopicSubscriber with the same name and a new topic and/or message selector. Changing a durable subscriber is equivalent to unsubscribing (deleting) the old one and creating a new one.

        Specified by:
        createDurableSubscriber in interface javax.jms.Session
        Parameters:
        topic - the non-temporary Topic to subscribe to
        name - the name used to identify this subscription
        messageSelector - only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.
        noLocal - if set, inhibits the delivery of messages published by its own connection
        Throws:
        javax.jms.JMSException - if the session fails to create a subscriber due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid topic is specified.
        javax.jms.InvalidSelectorException - if the message selector is invalid.
      • createReceiver

        public javax.jms.QueueReceiver createReceiver​(javax.jms.Queue queue)
                                               throws javax.jms.JMSException
        Creates a QueueReceiver object to receive messages from the specified queue.
        Parameters:
        queue - the Queue to access
        Throws:
        javax.jms.JMSException - if the session fails to create a receiver due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid queue is specified.
      • createReceiver

        public javax.jms.QueueReceiver createReceiver​(javax.jms.Queue queue,
                                                      java.lang.String messageSelector)
                                               throws javax.jms.JMSException
        Creates a QueueReceiver object to receive messages from the specified queue using a message selector.
        Parameters:
        queue - the Queue to access
        messageSelector - only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.
        Throws:
        javax.jms.JMSException - if the session fails to create a receiver due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid queue is specified.
        javax.jms.InvalidSelectorException - if the message selector is invalid.
      • createBrowser

        public javax.jms.QueueBrowser createBrowser​(javax.jms.Queue queue)
                                             throws javax.jms.JMSException
        Creates a QueueBrowser object to peek at the messages on the specified queue.
        Specified by:
        createBrowser in interface javax.jms.Session
        Parameters:
        queue - the queue to access
        Throws:
        javax.jms.JMSException - if the session fails to create a browser due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid destination is specified
      • createBrowser

        public javax.jms.QueueBrowser createBrowser​(javax.jms.Queue queue,
                                                    java.lang.String messageSelector)
                                             throws javax.jms.JMSException
        Creates a QueueBrowser object to peek at the messages on the specified queue using a message selector.
        Specified by:
        createBrowser in interface javax.jms.Session
        Parameters:
        queue - the queue to access
        messageSelector - only messages with properties matching the message selector expression are delivered. A value of null or an empty string indicates that there is no message selector for the message consumer.
        Throws:
        javax.jms.JMSException - if the session fails to create a browser due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid destination is specified
        javax.jms.InvalidSelectorException - if the message selector is invalid.
      • createQueueBrowserImpl

        protected WmQueueBrowserImpl createQueueBrowserImpl​(WmQueueImpl queue,
                                                            java.lang.String messageSelector)
                                                     throws javax.jms.JMSException
        Creates a queue implementation instance.
        Parameters:
        queue -
        messageSelector -
        Throws:
        javax.jms.JMSException
      • createTemporaryQueue

        public javax.jms.TemporaryQueue createTemporaryQueue()
                                                      throws javax.jms.JMSException
        Creates a TemporaryQueue object. Its lifetime will be that of the Connection unless it is deleted earlier.
        Specified by:
        createTemporaryQueue in interface javax.jms.Session
        Returns:
        a temporary queue identity
        Throws:
        javax.jms.JMSException - if the session fails to create a temporary queue due to some internal error.
      • getTemporaryQueueName

        protected java.lang.String getTemporaryQueueName​(java.lang.String clientID)
      • createTemporaryQueue

        public javax.jms.TemporaryQueue createTemporaryQueue​(java.lang.String queueName)
                                                      throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • createTemporaryTopic

        public javax.jms.TemporaryTopic createTemporaryTopic()
                                                      throws javax.jms.JMSException
        Creates a TemporaryTopic object. Its lifetime will be that of the Connection unless it is deleted earlier.
        Specified by:
        createTemporaryTopic in interface javax.jms.Session
        Returns:
        a temporary topic identity
        Throws:
        javax.jms.JMSException - if the session fails to create a temporary topic due to some internal error.
      • getTemporaryTopicName

        protected java.lang.String getTemporaryTopicName​(java.lang.String clientID)
      • unsubscribe

        public void unsubscribe​(java.lang.String name)
                         throws javax.jms.JMSException
        Unsubscribes a durable subscription that has been created by a client.

        This method deletes the state being maintained on behalf of the subscriber by its provider.

        It is erroneous for a client to delete a durable subscription while there is an active MessageConsumer or TopicSubscriber for the subscription, or while a consumed message is part of a pending transaction or has not been acknowledged in the session.

        Specified by:
        unsubscribe in interface javax.jms.Session
        Parameters:
        name - the name used to identify this subscription
        Throws:
        javax.jms.JMSException - if the session fails to unsubscribe to the durable subscription due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid subscription name is specified.
      • unsubscribe

        public void unsubscribe​(java.lang.String name,
                                boolean force)
                         throws javax.jms.JMSException
        Unsubscribes a durable subscription that has been created by a client.

        This method deletes the state being maintained on behalf of the subscriber by its provider.

        Parameters:
        name - the name used to identify this subscription
        force - true to forcibly unsubscribe even if the subscriber has consumed messages that are a part of the pending transaction or has not been acknowledged in the session
        Throws:
        javax.jms.JMSException - if the session fails to unsubscribe to the durable subscription due to some internal error.
        javax.jms.InvalidDestinationException - if an invalid subscription name is specified.
      • getConnection

        public WmConnection getConnection()
                                   throws javax.jms.JMSException
        Returns the connection used to create this session.
        Returns:
        the connection used to create his session
        Throws:
        javax.jms.JMSException - if the JMS provider fails to get the connection for this session.
      • getExceptionListener

        public javax.jms.ExceptionListener getExceptionListener()
                                                         throws javax.jms.JMSException
        Gets the ExceptionListener object for this session.
        Specified by:
        getExceptionListener in interface WmSession
        Returns:
        the ExceptionListener for this session, or null. if no ExceptionListener is associated with this session.
        Throws:
        javax.jms.JMSException - if the JMS provider fails to get the ExceptionListener for this session.
        See Also:
        setExceptionListener(javax.jms.ExceptionListener)
      • setExceptionListener

        public void setExceptionListener​(javax.jms.ExceptionListener listener)
                                  throws javax.jms.JMSException
        Sets an exception listener for this session.

        If an exception is thrown by a user-defined MessageListener's run() method from one of the session's MessageConsumers, it informs the sessions's ExceptionListener, if one has been registered. It does this by calling the listener's onException method, passing it a JMSException object with a linked exception containing the exception thrown by the MessageListener's run() method.

        Specified by:
        setExceptionListener in interface WmSession
        Parameters:
        listener - the exception listener
        Throws:
        javax.jms.JMSException - if the JMS provider fails to set the exception listener for this session.
        See Also:
        getExceptionListener()
      • createFileMessage

        public WmFileMessage createFileMessage()
                                        throws javax.jms.JMSException
        Description copied from interface: WmSession
        Creates a WmFileMessage object. A WmFileMessage object is used to stream a file that is to large to load into memory.
        Specified by:
        createFileMessage in interface WmSession
        Throws:
        javax.jms.JMSException - if the JMS provider fails to create this message due to some internal error.
      • invokeExceptionListener

        protected void invokeExceptionListener​(java.lang.Exception exception)
      • checkState

        protected void checkState()
                           throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • checkCreateConsumer

        protected void checkCreateConsumer​(javax.jms.Destination destination)
                                    throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • checkCreateProducer

        protected void checkCreateProducer​(javax.jms.Destination destination)
                                    throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • checkCreateDurableConsumer

        protected void checkCreateDurableConsumer​(javax.jms.Destination destination)
                                           throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • checkForClusteringSupport

        protected void checkForClusteringSupport​(javax.jms.MessageConsumer consumer,
                                                 javax.jms.Destination destination)
                                          throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • start

        public void start()
                   throws javax.jms.JMSException
        Starts synchronous and asynchronous message delivery. Called by Connection.start().
        Throws:
        javax.jms.JMSException
      • stop

        public void stop()
                  throws javax.jms.JMSException
        Stops synchronous and asynchronous message delivery. Called by Connection.stop().
        Throws:
        javax.jms.JMSException
      • addSessionSubscriberMessageConsumer

        public void addSessionSubscriberMessageConsumer​(WmMessageConsumer messageConsumer)
      • removeSessionSubscriberMessageConsumer

        public void removeSessionSubscriberMessageConsumer​(WmMessageConsumer messageConsumer)
      • closeMessageConsumers

        protected void closeMessageConsumers()
                                      throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • removeMessageProducer

        protected void removeMessageProducer​(WmMessageProducerImpl messageProducer)
      • closeMessageProducers

        protected void closeMessageProducers()
                                      throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • publish

        public void publish​(WmMessageImpl message,
                            int deliveryMode,
                            boolean deliver)
                     throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • publish

        public void publish​(WmMessageImpl[] messages,
                            int deliveryMode,
                            boolean deliver)
                     throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • sessionAcknowledge

        public void sessionAcknowledge()
                                throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • sessionAcknowledgeInternal

        public void sessionAcknowledgeInternal​(java.lang.Thread sessionThread)
                                        throws javax.jms.JMSException
        Acknowledge all received but unacknowledged messages on this session. Only takes effect if the session is in CLIENT_ACKNOWLEDGE acknowledgement mode. Called by WmMessageImpl.acknowledge().
        Throws:
        javax.jms.JMSException
      • setMessageListener

        public void setMessageListener​(WmMessageConsumerImpl consumer,
                                       javax.jms.MessageListener listener)
        A message listener has been added to a message consumer. Wake up the session's dispatcher so that any messages received synchronously can now be processed asynchronously.
      • validAcknowledgeMode

        protected boolean validAcknowledgeMode​(int acknowledgeMode)
        Validates an acknowledge mode.
        Parameters:
        acknowledgeMode - the acknowledge mode to validate
        Returns:
        true if the acknowledge mode is valid, false otherwise
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • get_transactionID

        public long get_transactionID()
      • getBrokerName

        public java.lang.String getBrokerName()
                                       throws javax.jms.JMSException
        Gets the underlying broker name
        Throws:
        javax.jms.JMSException
      • getMessageConsumers

        public java.util.Vector<WmMessageConsumer> getMessageConsumers()
      • isTransacted

        public boolean isTransacted()
      • getSessionDispatcherThreadID

        public long getSessionDispatcherThreadID()
        Used for clustering.
      • addMessageToQueue

        public void addMessageToQueue​(WmMessageImpl message)
        Adds the message into the message queue.
        Parameters:
        message -
      • setCurrentAsynMessage

        public void setCurrentAsynMessage​(WmMessageImpl message)
        Sets the current async message, which will be included in the transaction. Is called from within the ASF APIs.
        Parameters:
        message -