Class TrackedClientSet

    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.util.Map clientMap_  
      private java.util.Map clientMapView_  
    • Constructor Summary

      Constructors 
      Constructor Description
      TrackedClientSet()
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addClient​(Client client)
      Adds a client to this model.
      java.util.Map getClientMap()
      Returns an unmodifiable Map representing the client list.
      void removeClient​(Client client)
      Removes a client from this model.
      void setClients​(Client[] clients)
      Sets the contents of this model to a given list.
      void updateClient​(Client client, boolean metaChanged, boolean subsChanged)
      Notifies listeners that a given client's attributes (may) have changed.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • clientMap_

        private final java.util.Map clientMap_
      • clientMapView_

        private final java.util.Map clientMapView_
    • Constructor Detail

      • TrackedClientSet

        public TrackedClientSet()
        Constructor.
    • Method Detail

      • addClient

        public void addClient​(Client client)
        Adds a client to this model. Listeners are informed. May be called from any thread.
        Parameters:
        client - client to add
      • removeClient

        public void removeClient​(Client client)
        Removes a client from this model. Listeners are informed. May be called from any thread.
        Parameters:
        client - client to remove
      • setClients

        public void setClients​(Client[] clients)
        Sets the contents of this model to a given list. Listeners are informed. May be called from any thread.
        Parameters:
        clients - current client list
      • updateClient

        public void updateClient​(Client client,
                                 boolean metaChanged,
                                 boolean subsChanged)
        Notifies listeners that a given client's attributes (may) have changed. May be called from any thread.
        Parameters:
        client - modified client
        metaChanged - true if metadata may have changed (false if known unchanged)
        subsChanged - true if subscriptions may have changed (false if known unchanged)
      • getClientMap

        public java.util.Map getClientMap()
        Returns an unmodifiable Map representing the client list. Keys are client IDs and values are Client objects.

        This map is synchronized which means that to iterate over any of its views you must synchronize on it. When the map or any of its contents changes, it will receive a Object.notifyAll().

        Returns:
        id -> Client map