java.lang.Object
org.jolokia.server.core.service.notification.Client

public class Client extends Object
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 Details

    • Client

      public Client(String pId)
      Initialize
      Parameters:
      pId - unique id for this client
  • Method Details

    • getHandles

      public Set<String> getHandles()
      Get a set of all known handles
      Returns:
      handles
    • addNotification

      public void addNotification(String pHandle, ListenerRegistration pRegistration)
      A a new listener registration to this config
      Parameters:
      pRegistration - registration to add
      pHandle - to add to
    • getNextHandle

      public String getNextHandle()
      Increment handle and return it. This method must be used together with add() in a synchronized blog.
      Returns:
      next handle
    • get

      public ListenerRegistration get(String pHandle)
      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

      public void remove(String pHandle)
      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

      public String getId()
      UUID of this client
      Returns:
      id
    • getBackChannel

      public BackChannel getBackChannel(String pMode)
      Return the HTTP back channel or null if none is set.
      Parameters:
      pMode - for which backend a channel is required
      Returns:
      back channel
    • setBackChannel

      public void setBackChannel(String pMode, BackChannel pChannel)
      Set a back channel from the outside
      Parameters:
      pMode - backend mode
      pChannel - back channel to use
    • addUsedBackend

      public void addUsedBackend(String pType)
      Add a backend which is used by this client
      Parameters:
      pType - backend type