Interface TopicService

    • Method Detail

      • ensureTopic

        <T> NamedTopic<T> ensureTopic​(String sName,
                                      ClassLoader loader)
        Obtain a Topic interface that provides
        Parameters:
        sName - - the name, within this TopicService, that uniquely identifies a topic
        loader - ClassLoader that should be used to deserialize messages sent to the topic by other members of the cluster; null is legal, and implies the default ClassLoader, which will typically be the context ClassLoader for this service
        Returns:
        a NamedTopic interface which can be used to access the resources of the specified topic
      • releaseTopic

        void releaseTopic​(NamedTopic topic)
        Release local resources associated with the specified instance of the topic. This invalidates a reference obtained by using the ensureTopic(String, ClassLoader) method.

        Releasing a topic reference to a topic makes the topic reference no longer usable, but does not affect the topic itself. In other words, all other references to the topic will still be valid, and the topic data is not affected by releasing the reference.

        The reference that is released using this method can no longer be used; any attempt to use the reference will result in an exception.

        The purpose for releasing a topic reference is to allow the topic implementation to release the ClassLoader used to deserialize items in the topic. The topic implementation ensures that all references to that ClassLoader are released. This implies that objects in the topic that were loaded by that ClassLoader will be re-serialized to release their hold on that ClassLoader. The result is that the ClassLoader can be garbage-collected by Java in situations where the topic is operating in an application server and applications are dynamically loaded and unloaded.

        Parameters:
        topic - the topic object to be released
        See Also:
        Releasable.release()
      • destroyTopic

        void destroyTopic​(NamedTopic topic)
        Release and destroy the specified topic.

        Warning: This method is used to completely destroy the specified topic across the cluster. All references in the entire cluster to this topic will be invalidated, the data will be cleared, and all resources will be released.

        Parameters:
        topic - the cache object to be released
        See Also:
        NamedCollection.destroy()
      • getChannelCount

        int getChannelCount​(String sName)
        Return the number of channels the topic has.
        Parameters:
        sName - the name of the topic
        Returns:
        the number of channels the topic has
      • ensureChannelCount

        default int ensureChannelCount​(String sName,
                                       int cChannel)
        Ensure the specified topic has at least the required number of channels.
        Parameters:
        sName - the name of the topic
        cChannel - the required channel count
        Returns:
        the number of channels the topic has
      • ensureChannelCount

        int ensureChannelCount​(String sName,
                               int cRequired,
                               int cChannel)
        Ensure the specified topic has at least the required number of channels.
        Parameters:
        sName - the name of the topic
        cRequired - the minimum required channel count
        cChannel - the channel count to set if the current count is less than cRequired
        Returns:
        the number of channels the topic has
      • getTopicNames

        Set<String> getTopicNames()
        Returns the names of the topics known to this service.
        Returns:
        the names of the topics known to this service