Class Client
java.lang.Object
org.jolokia.server.core.service.notification.Client
A Client holds all listener registration for a specific client. Also, it knows
how to create handles for new listener registrations and remembers the last ping of
a client.
- Since:
- 18.03.13
- Author:
- roland
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNotification(String pHandle, ListenerRegistration pRegistration) A a new listener registration to this configvoidaddUsedBackend(String pType) Add a backend which is used by this clientGet a registration object for a given handle.getBackChannel(String pMode) Return the HTTP back channel ornullif none is set.Get a set of all known handlesgetId()UUID of this clientlongGet the last refresh time of this configurationIncrement handle and return it.org.json.simple.JSONObjectlist()Print out a JSON representation of all registered listeners.voidrefresh()Refresh this configuration by setting the last refresh time to the current time.voidRemove a handle.voidsetBackChannel(String pMode, BackChannel pChannel) Set a back channel from the outside
-
Constructor Details
-
Client
Initialize- Parameters:
pId- unique id for this client
-
-
Method Details
-
getHandles
Get a set of all known handles- Returns:
- handles
-
addNotification
A a new listener registration to this config- Parameters:
pRegistration- registration to addpHandle- to add to
-
getNextHandle
Increment handle and return it. This method must be used together with add() in a synchronized blog.- Returns:
- next handle
-
get
Get a registration object for a given handle. If this handle is not known, an exception is thrown.- Parameters:
pHandle- handle to lookup- Returns:
- registration object
-
remove
Remove a handle. If now known, this will be silently ignored.- Parameters:
pHandle- handle to remove.
-
refresh
public void refresh()Refresh this configuration by setting the last refresh time to the current time. -
list
public org.json.simple.JSONObject list()Print out a JSON representation of all registered listeners. The key are the handles, the value is the corresponding registration.- Returns:
- JSON object for this configuration.
-
getLastRefresh
public long getLastRefresh()Get the last refresh time of this configuration- Returns:
- last refresh (epoch millis)
-
getId
UUID of this client- Returns:
- id
-
getBackChannel
Return the HTTP back channel ornullif none is set.- Parameters:
pMode- for which backend a channel is required- Returns:
- back channel
-
setBackChannel
Set a back channel from the outside- Parameters:
pMode- backend modepChannel- back channel to use
-
addUsedBackend
Add a backend which is used by this client- Parameters:
pType- backend type
-