Class WmClusterConnectionImpl

    • Constructor Detail

      • WmClusterConnectionImpl

        public WmClusterConnectionImpl​(WmConnectionFactoryImpl factory,
                                       java.lang.String username,
                                       java.lang.String password,
                                       boolean isXA)
                                throws javax.jms.JMSException
        Protected constructor.
        Parameters:
        factory - the factory that created this connection
        username - the caller's user name
        password - the caller's password
        Throws:
        javax.jms.JMSException
      • WmClusterConnectionImpl

        protected WmClusterConnectionImpl()
      • WmClusterConnectionImpl

        public WmClusterConnectionImpl​(WmConnectionFactoryImpl factory,
                                       java.lang.String username,
                                       java.lang.String password,
                                       java.lang.String accessLabelHint,
                                       boolean isXA)
                                throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
    • Method Detail

      • getMultiSendBEIndex

        public int getMultiSendBEIndex()
      • setMultiSendBEIndex

        public void setMultiSendBEIndex​(int index)
      • getMultiSendBESeeder

        public int[] getMultiSendBESeeder()
      • setMultiSendBESeeder

        public void setMultiSendBESeeder​(int[] seeder)
      • getPolicy

        protected WmClusterPolicy getPolicy()
                                     throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • setTrackerCategories

        public void setTrackerCategories​(java.lang.String[] enabledCategories)
        Configure a set of tracking types.
        Specified by:
        setTrackerCategories in interface WmClusterTrackable
        Parameters:
        enabledCategories - name of the action type to be tracked
      • getBrokerCluster

        public java.util.concurrent.CopyOnWriteArrayList<java.lang.String> getBrokerCluster()
      • getAllBrokersInCluster

        public java.util.concurrent.CopyOnWriteArrayList<java.lang.String> getAllBrokersInCluster()
      • getNextBrokerToPublish

        public java.lang.String getNextBrokerToPublish()
                                                throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • getCurrentBrokerIndex

        public int getCurrentBrokerIndex()
      • getNextWorker

        protected WmClusterConnectionWorker getNextWorker()
                                                   throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • getConnectionList

        public java.util.Iterator<WmConnectionImpl> getConnectionList()
      • setClientID

        public void setClientID​(java.lang.String clientID)
                         throws javax.jms.JMSException
        Sets the client identifier for this connection.
        Specified by:
        setClientID in interface javax.jms.Connection
        Overrides:
        setClientID in class WmConnectionImpl
        Parameters:
        clientID - the unique client identifier
        Throws:
        javax.jms.JMSException - if the JMS provider fails to set the client ID for this connection due to some internal error.
        javax.jms.InvalidClientIDException - if the JMS client specifies an invalid or duplicate client ID.
        javax.jms.IllegalStateException - if the JMS client attempts to set a connection's client ID at the wrong time or when it has been administratively configured.
      • start

        public void start()
                   throws javax.jms.JMSException
        Starts (or restarts) this cluster connection's delivery of incoming messages.
        Specified by:
        start in interface javax.jms.Connection
        Overrides:
        start in class WmConnectionImpl
        Throws:
        javax.jms.JMSException - if the JMS provider fails to start message delivery due to some internal error.
      • stop

        public void stop()
                  throws javax.jms.JMSException
        Temporarily stops a connection's delivery of incoming messages.
        Specified by:
        stop in interface javax.jms.Connection
        Overrides:
        stop in class WmConnectionImpl
        Throws:
        javax.jms.JMSException
      • markForClosure

        public void markForClosure​(boolean exceptionOccurred)
                            throws javax.jms.JMSException
        Marks the connection for closure.
        Overrides:
        markForClosure in class WmConnectionImpl
        Throws:
        javax.jms.JMSException
      • close

        public void close()
                   throws javax.jms.JMSException
        Closes the connection.
        Specified by:
        close in interface javax.jms.Connection
        Overrides:
        close in class WmConnectionImpl
        Throws:
        javax.jms.JMSException - if the JMS provider fails to close the connection due to some internal error. For example, a failure to release resources or to close a socket connection can cause this exception to be thrown.
      • createSession

        public javax.jms.Session createSession​(boolean transacted,
                                               int acknowledgeMode)
                                        throws javax.jms.JMSException
        Overwrites the WmConnectionImpl behavior to create a cluster session.
        Specified by:
        createSession in interface javax.jms.Connection
        Overrides:
        createSession in class WmConnectionImpl
        Parameters:
        transacted - indicates whether the session is transacted
        acknowledgeMode - indicates whether the consumer or the client will acknowledge any messages it receives; ignored if the session is transacted. Legal values are Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, and Session.DUPS_OK_ACKNOWLEDGE.
        Returns:
        a newly created session
        Throws:
        javax.jms.JMSException - if the Connection object fails to create a session due to some internal error or lack of support for the specific transaction and acknowledgement mode.
      • createXASession

        public javax.jms.XASession createXASession()
                                            throws javax.jms.JMSException
        Creates an XASession object.
        Overrides:
        createXASession in class WmConnectionImpl
        Returns:
        a newly created XASession
        Throws:
        javax.jms.JMSException - if the XAConnection object fails to create an XASession due to some internal error.
      • createXASession

        public javax.jms.XASession createXASession​(java.lang.String brokerURL)
                                            throws javax.jms.JMSException
        Creates an XASession object. This method is used only for recovery purposes.
        Parameters:
        brokerURL - url pointing to the underlying broker.
        Returns:
        a newly created XASession
        Throws:
        javax.jms.JMSException - if the XAConnection object fails to create an XASession due to some internal error.
      • createTopicSession

        public javax.jms.TopicSession createTopicSession​(boolean transacted,
                                                         int acknowledgeMode)
                                                  throws javax.jms.JMSException
        Creates a TopicSession object.
        Overrides:
        createTopicSession in class WmConnectionImpl
        Parameters:
        transacted - indicates whether the session is transacted
        acknowledgeMode - indicates whether the consumer or the client will acknowledge any messages it receives; ignored if the session is transacted. Legal values are Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, and Session.DUPS_OK_ACKNOWLEDGE.
        Returns:
        a newly created topic session
        Throws:
        javax.jms.JMSException - if the TopicConnection object fails to create a session due to some internal error or lack of support for the specific transaction and acknowledgement mode.
      • createXATopicSession

        public javax.jms.XATopicSession createXATopicSession()
                                                      throws javax.jms.JMSException
        Creates an XATopicSession object.
        Overrides:
        createXATopicSession in class WmConnectionImpl
        Returns:
        a newly created XA topic session
        Throws:
        javax.jms.JMSException - if the XATopicConnection object fails to create an XA topic session due to some internal error.
      • createXATopicSession

        public javax.jms.XATopicSession createXATopicSession​(java.lang.String brokerURL)
                                                      throws javax.jms.JMSException
        Creates an XATopicSession object. This method is used only for the purpose of transaction recovery.
        Parameters:
        brokerURL - url pointing to the underlying broker.
        Returns:
        a newly created XA topic session
        Throws:
        javax.jms.JMSException - if the XATopicConnection object fails to create an XA topic session due to some internal error.
      • createQueueSession

        public javax.jms.QueueSession createQueueSession​(boolean transacted,
                                                         int acknowledgeMode)
                                                  throws javax.jms.JMSException
        Creates a QueueSession object.
        Overrides:
        createQueueSession in class WmConnectionImpl
        Parameters:
        transacted - indicates whether the session is transacted
        acknowledgeMode - indicates whether the consumer or the client will acknowledge any messages it receives; ignored if the session is transacted. Legal values are Session.AUTO_ACKNOWLEDGE, Session.CLIENT_ACKNOWLEDGE, and Session.DUPS_OK_ACKNOWLEDGE.
        Returns:
        a newly created queue session
        Throws:
        javax.jms.JMSException - if the QueueConnection object fails to create a session due to some internal error or lack of support for the specific transaction and acknowledgement mode.
      • createXAQueueSession

        public javax.jms.XAQueueSession createXAQueueSession()
                                                      throws javax.jms.JMSException
        Creates an XAQueueSession object.
        Overrides:
        createXAQueueSession in class WmConnectionImpl
        Returns:
        a newly created XAQueueSession
        Throws:
        javax.jms.JMSException - if the XAQueueConnection object fails to create an XA queue session due to some internal error.
      • createXAQueueSession

        public javax.jms.XAQueueSession createXAQueueSession​(java.lang.String brokerURL)
                                                      throws javax.jms.JMSException
        Creates an XAQueueSession object.
        Parameters:
        brokerURL - - url pointing to the underlying broker.
        Returns:
        a newly created XAQueueSession
        Throws:
        javax.jms.JMSException - if the XAQueueConnection object fails to create an XA queue session due to some internal error.
      • ping

        public void ping()
                  throws javax.jms.JMSException
        Pings the brokers in the cluster to determine if there is network connectivity.
        Specified by:
        ping in interface WmConnection
        Overrides:
        ping in class WmConnectionImpl
        Throws:
        javax.jms.JMSException - if the JMS provider fails to ping the Broker
      • canPublish

        public void canPublish​(javax.jms.Destination destination)
                        throws javax.jms.JMSException
        Overrides:
        canPublish in class WmConnectionImpl
        Throws:
        javax.jms.JMSException
      • createWeightedRRList

        public void createWeightedRRList()
                                  throws javax.jms.JMSException
        Throws:
        javax.jms.JMSException
      • getWeigthRRBrokers

        public java.util.concurrent.CopyOnWriteArrayList<java.lang.String> getWeigthRRBrokers()
      • getWeightedMap

        public java.util.concurrent.ConcurrentHashMap<java.lang.String,​java.lang.Integer> getWeightedMap()
      • getClusterConnectionId

        public java.lang.String getClusterConnectionId()
      • setClusterConnectionId

        public void setClusterConnectionId​(java.lang.String clusterConnectionId)
      • createDurableConnectionConsumer

        public javax.jms.ConnectionConsumer createDurableConnectionConsumer​(javax.jms.Topic topic,
                                                                            java.lang.String subscriptionName,
                                                                            java.lang.String messageSelector,
                                                                            javax.jms.ServerSessionPool sessionPool,
                                                                            int maxMessages)
                                                                     throws javax.jms.JMSException
        Description copied from class: WmConnectionImpl
        Create a durable connection consumer for this connection (optional operation). This is an expert facility not used by regular JMS clients.
        Specified by:
        createDurableConnectionConsumer in interface javax.jms.Connection
        Overrides:
        createDurableConnectionConsumer in class WmConnectionImpl
        Parameters:
        topic - topic to access
        subscriptionName - durable subscription name
        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.
        sessionPool - the server session pool to associate with this durable connection consumer
        maxMessages - the maximum number of messages that can be assigned to a server session at one time
        Returns:
        the durable connection consumer
        Throws:
        javax.jms.JMSException - if the Connection object fails to create a connection consumer due to some internal error or invalid arguments for sessionPool and messageSelector.
        javax.jms.InvalidDestinationException - if an invalid destination is specified.
        javax.jms.InvalidSelectorException - if the message selector is invalid.
      • createConnectionConsumer

        public javax.jms.ConnectionConsumer createConnectionConsumer​(javax.jms.Queue queue,
                                                                     java.lang.String messageSelector,
                                                                     javax.jms.ServerSessionPool sessionPool,
                                                                     int maxMessages)
                                                              throws javax.jms.JMSException
        Description copied from class: WmConnectionImpl
        Creates a connection consumer for this connection (optional operation). This is an expert facility not used by regular JMS clients.
        Overrides:
        createConnectionConsumer in class WmConnectionImpl
        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.
        sessionPool - the server session pool to associate with this connection consumer
        maxMessages - the maximum number of messages that can be assigned to a server session at one time
        Returns:
        the connection consumer
        Throws:
        javax.jms.JMSException - if the QueueConnection object fails to create a connection consumer due to some internal error or invalid arguments for sessionPool and messageSelector.
        javax.jms.InvalidDestinationException - if an invalid queue is specified.
        javax.jms.InvalidSelectorException - if the message selector is invalid.
      • createConnectionConsumer

        public javax.jms.ConnectionConsumer createConnectionConsumer​(javax.jms.Topic topic,
                                                                     java.lang.String messageSelector,
                                                                     javax.jms.ServerSessionPool sessionPool,
                                                                     int maxMessages)
                                                              throws javax.jms.JMSException
        Description copied from class: WmConnectionImpl
        Creates a connection consumer for this connection (optional operation). This is an expert facility not used by regular JMS clients.
        Overrides:
        createConnectionConsumer in class WmConnectionImpl
        Parameters:
        topic - the topic 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.
        sessionPool - the server session pool to associate with this connection consumer
        maxMessages - the maximum number of messages that can be assigned to a server session at one time
        Returns:
        the connection consumer
        Throws:
        javax.jms.JMSException - if the TopicConnection object fails to create a connection consumer due to some internal error or invalid arguments for sessionPool and messageSelector.
        javax.jms.InvalidDestinationException - if an invalid topic is specified.
        javax.jms.InvalidSelectorException - if the message selector is invalid.
      • createConnectionConsumer

        public javax.jms.ConnectionConsumer createConnectionConsumer​(javax.jms.Destination destination,
                                                                     java.lang.String messageSelector,
                                                                     javax.jms.ServerSessionPool sessionPool,
                                                                     int maxMessages)
                                                              throws javax.jms.JMSException
        Creates a connection consumer for this connection (optional operation). This is an expert facility not used by regular JMS clients.
        Specified by:
        createConnectionConsumer in interface javax.jms.Connection
        Overrides:
        createConnectionConsumer in class WmConnectionImpl
        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.
        sessionPool - the server session pool to associate with this connection consumer
        maxMessages - the maximum number of messages that can be assigned to a server session at one time
        Returns:
        the connection consumer
        Throws:
        javax.jms.JMSException - if the Connection object fails to create a connection consumer due to some internal error or invalid arguments for sessionPool and messageSelector.
        javax.jms.InvalidDestinationException - if an invalid destination is specified.
        javax.jms.InvalidSelectorException - if the message selector is invalid.
      • getNotificationListener

        public WmNotificationListener getNotificationListener()
                                                       throws javax.jms.JMSException
        Description copied from class: WmConnectionImpl
        Gets the NotificationListener object for this connection. Not every Connection has an NotificationListener associated with it.
        Overrides:
        getNotificationListener in class WmConnectionImpl
        Returns:
        the NotificationListener for this connection, or null. if no NotificationListener is associated with this connection.
        Throws:
        javax.jms.JMSException - if the JMS provider fails to get the NotificationListener for this connection.
      • setNotificationListener

        public void setNotificationListener​(WmNotificationListener listener)
                                     throws javax.jms.JMSException
        Sets an notification listener for this connection.

        An notification listener allows a client to be notified of a problem asynchronously. Some connections only consume messages, so they would have no other way to learn their connection has failed.

        A connection serializes execution of its ExceptionListener.

        A JMS provider should attempt to resolve connection problems itself before it notifies the client of them.

        Overrides:
        setNotificationListener in class WmConnectionImpl
        Parameters:
        listener - the exception listener
        Throws:
        javax.jms.JMSException - if the JMS provider fails to set the exception listener for this connection.
      • getMetaData

        public javax.jms.ConnectionMetaData getMetaData()
                                                 throws javax.jms.JMSException
        Description copied from class: WmConnectionImpl
        Gets the metadata for this connection.
        Specified by:
        getMetaData in interface javax.jms.Connection
        Overrides:
        getMetaData in class WmConnectionImpl
        Returns:
        the connection metadata
        Throws:
        javax.jms.JMSException - if the JMS provider fails to get the connection metadata for this connection.
      • getExceptionListener

        public javax.jms.ExceptionListener getExceptionListener()
                                                         throws javax.jms.JMSException
        Description copied from class: WmConnectionImpl
        Gets the ExceptionListener object for this connection. Not every Connection has an ExceptionListener associated with it.
        Specified by:
        getExceptionListener in interface javax.jms.Connection
        Overrides:
        getExceptionListener in class WmConnectionImpl
        Returns:
        the ExceptionListener for this connection, or null. if no ExceptionListener is associated with this connection.
        Throws:
        javax.jms.JMSException - if the JMS provider fails to get the ExceptionListener for this connection.
      • setExceptionListener

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

        If a JMS provider detects a serious problem with a connection, it informs the connection's ExceptionListener, if one has been registered. It does this by calling the listener's onException method, passing it a JMSException object describing the problem.

        An exception listener allows a client to be notified of a problem asynchronously. Some connections only consume messages, so they would have no other way to learn their connection has failed.

        A connection serializes execution of its ExceptionListener.

        A JMS provider should attempt to resolve connection problems itself before it notifies the client of them.

        Specified by:
        setExceptionListener in interface javax.jms.Connection
        Overrides:
        setExceptionListener in class WmConnectionImpl
        Parameters:
        listener - the exception listener
        Throws:
        javax.jms.JMSException - if the JMS provider fails to set the exception listener for this connection.
      • open1PCLog

        public void open1PCLog()
        Open a writer to the 1PC log.
      • write1PCLog

        public void write1PCLog​(java.lang.String message)
        Write the 1pC transaction log message to the file.
      • close1PCLog

        public void close1PCLog()
        Close the 1PC transaction log...
      • getWriter

        public java.io.Writer getWriter()