Class TopicManager
- java.lang.Object
-
- org.forgerock.openig.tools.notifications.ws.TopicManager
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class TopicManager extends Object implements Closeable
TopicManager
is responsible for topic registration multiplexing.As AM does not manage multiple subscriptions to the same topic from a client, this class has to do the subscription multiplexing itself. In other words, it maintains a map of subscribed
TopicManager.Topic
s, each of which has a reference counter used to detect when an un-registration action needs to be performed.The first time a topic is subscribed to, this class sends a subscription message to AM and waits for the acknowledgment. Every subsequent subscription to the same topic will reuse the same "connection" without sending a subscription request. Inversely, no un-subscription request is sent to AM until the last reference is removed.
-
-
Constructor Summary
Constructors Constructor Description TopicManager(Supplier<String> id)
TopicManager
constructor taking an ID generator and message handler to handle notifications.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
void
renewSession(WebSocketAdapter webSocket)
Refresh theTopicManager
session with a new WebSocket (on reconnection).
-
-
-
Method Detail
-
renewSession
public void renewSession(WebSocketAdapter webSocket)
Refresh theTopicManager
session with a new WebSocket (on reconnection).- Parameters:
webSocket
- the WebSocket to use to handle notification registration
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-