Class AbstractConnection

  • All Implemented Interfaces:
    javax.jms.Connection
    Direct Known Subclasses:
    LocalConnection, RemoteConnection

    public abstract class AbstractConnection
    extends Object
    implements javax.jms.Connection

    Base implementation for a JMS connection

    • Field Detail

      • clientID

        protected String clientID
      • started

        protected boolean started
      • closed

        protected boolean closed
    • Constructor Detail

      • AbstractConnection

        public AbstractConnection​(String clientID)
        Constructor
    • Method Detail

      • getId

        public String getId()
        Get the connection id
        Returns:
        the id
      • getClientID

        public String getClientID()
                           throws javax.jms.JMSException
        Specified by:
        getClientID in interface javax.jms.Connection
        Throws:
        javax.jms.JMSException
      • getMetaData

        public javax.jms.ConnectionMetaData getMetaData()
        Specified by:
        getMetaData in interface javax.jms.Connection
      • setClientID

        public void setClientID​(String clientID)
                         throws javax.jms.JMSException
        Specified by:
        setClientID in interface javax.jms.Connection
        Throws:
        javax.jms.JMSException
      • getExceptionListener

        public javax.jms.ExceptionListener getExceptionListener()
        Specified by:
        getExceptionListener in interface javax.jms.Connection
      • setExceptionListener

        public void setExceptionListener​(javax.jms.ExceptionListener listener)
                                  throws javax.jms.JMSException
        Specified by:
        setExceptionListener in interface javax.jms.Connection
        Throws:
        javax.jms.JMSException
      • exceptionOccured

        public final void exceptionOccured​(javax.jms.JMSException exception)
        Triggered when a JMSException is internally catched
      • registerTemporaryQueue

        public final void registerTemporaryQueue​(String queueName)
        Register a temporary queue name
      • unregisterTemporaryQueue

        public final void unregisterTemporaryQueue​(String queueName)
        Unregister a temporary queue name
      • isRegisteredTemporaryQueue

        public final boolean isRegisteredTemporaryQueue​(String queueName)
        Check if a temporary queue was registered with this connection
      • registerTemporaryTopic

        public final void registerTemporaryTopic​(String topicName)
        Register a temporary topic name
      • unregisterTemporaryTopic

        public final void unregisterTemporaryTopic​(String topicName)
        Unregister a temporary topic name
      • isRegisteredTemporaryTopic

        public final boolean isRegisteredTemporaryTopic​(String topicName)
        Check if a temporary topic was registered with this connection
      • deleteTemporaryQueue

        public abstract void deleteTemporaryQueue​(String queueName)
                                           throws javax.jms.JMSException
        Delete a temporary queue
        Throws:
        javax.jms.JMSException
      • deleteTemporaryTopic

        public abstract void deleteTemporaryTopic​(String topicName)
                                           throws javax.jms.JMSException
        Delete a temporary topic
        Throws:
        javax.jms.JMSException
      • close

        public final void close()
        Specified by:
        close in interface javax.jms.Connection
      • onConnectionClose

        protected void onConnectionClose()
      • onConnectionClosed

        protected void onConnectionClosed()
      • wakeUpLocalConsumers

        protected final void wakeUpLocalConsumers()
        Wake up all children consumers (Used by LocalConnection only)
      • waitForDeliverySync

        protected final void waitForDeliverySync()
        Wait for sessions to finish the current deliveridispatching
      • lookupRegisteredSession

        public final AbstractSession lookupRegisteredSession​(IntegerID sessionId)
        Lookup a registered session
      • registerSession

        protected final void registerSession​(AbstractSession sessionToAdd)
        Register a session
      • unregisterSession

        public final void unregisterSession​(AbstractSession sessionToRemove)
        Unregister a session
      • checkNotClosed

        protected final void checkNotClosed()
                                     throws javax.jms.JMSException
        Check that the connection is not closed
        Throws:
        javax.jms.JMSException
      • createConnectionConsumer

        public javax.jms.ConnectionConsumer createConnectionConsumer​(javax.jms.Destination destination,
                                                                     String messageSelector,
                                                                     javax.jms.ServerSessionPool sessionPool,
                                                                     int maxMessages)
                                                              throws javax.jms.JMSException
        Specified by:
        createConnectionConsumer in interface javax.jms.Connection
        Throws:
        javax.jms.JMSException
      • createDurableConnectionConsumer

        public javax.jms.ConnectionConsumer createDurableConnectionConsumer​(javax.jms.Topic topic,
                                                                            String subscriptionName,
                                                                            String messageSelector,
                                                                            javax.jms.ServerSessionPool sessionPool,
                                                                            int maxMessages)
                                                                     throws javax.jms.JMSException
        Specified by:
        createDurableConnectionConsumer in interface javax.jms.Connection
        Throws:
        javax.jms.JMSException
      • isStarted

        public boolean isStarted()
        Check if the connection is started NOT SYNCHRONIZED TO AVOID DEADLOCKS
      • getSessionsCount

        public int getSessionsCount()
        Get the number of active sessions for this connection
        Returns:
        the number of active sessions for this connection
      • getConsumersCount

        public int getConsumersCount()
        Get the number of active producers for this connection
        Returns:
        the number of active producers for this connection
      • getProducersCount

        public int getProducersCount()
        Get the number of active producers for this connection
        Returns:
        the number of active producers for this connection
      • getEntitiesDescription

        public void getEntitiesDescription​(StringBuilder sb)
        Get a description of entities held by this object