Interface TopicService
-
- All Superinterfaces:
ClassLoaderAware
,Controllable
,Service
,Service
- All Known Subinterfaces:
PagedTopicService
public interface TopicService extends Service
A TopicService is a service providing Topics that can be used for publish/subscribe functionality and message queue processing.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.tangosol.net.Service
Service.MemberJoinAction
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description void
destroyTopic(NamedTopic topic)
Release and destroy the specified topic.default int
ensureChannelCount(String sName, int cChannel)
Ensure the specified topic has at least the required number of channels.int
ensureChannelCount(String sName, int cRequired, int cChannel)
Ensure the specified topic has at least the required number of channels.<T> NamedTopic<T>
ensureTopic(String sName, ClassLoader loader)
Obtain a Topic interface that providesint
getChannelCount(String sName)
Return the number of channels the topic has.TopicBackingMapManager
getTopicBackingMapManager()
Return theTopicBackingMapManager
.Set<String>
getTopicNames()
Returns the names of the topics known to this service.void
releaseTopic(NamedTopic topic)
Release local resources associated with the specified instance of the topic.-
Methods inherited from interface com.tangosol.io.ClassLoaderAware
getContextClassLoader, setContextClassLoader
-
Methods inherited from interface com.tangosol.util.Controllable
configure, isRunning, shutdown, start, stop
-
Methods inherited from interface com.tangosol.net.Service
addMemberListener, getCluster, getDependencies, getInfo, getMinimumServiceVersion, getResourceRegistry, getSerializer, getUserContext, isSuspended, isVersionCompatible, isVersionCompatible, isVersionCompatible, isVersionCompatible, removeMemberListener, setDependencies, setUserContext
-
Methods inherited from interface com.tangosol.util.Service
addServiceListener, removeServiceListener
-
-
-
-
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 topicloader
- 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 theensureTopic(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()
-
getTopicBackingMapManager
TopicBackingMapManager getTopicBackingMapManager()
Return theTopicBackingMapManager
.- Returns:
- the TopicBackingMapManager
-
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 topiccChannel
- 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 topiccRequired
- the minimum required channel countcChannel
- the channel count to set if the current count is less thancRequired
- Returns:
- the number of channels the topic has
-
-