Class OortMap<K,​V>

    • Constructor Detail

      • OortMap

        protected OortMap​(Oort oort,
                          java.lang.String name,
                          OortObject.Factory<java.util.concurrent.ConcurrentMap<K,​V>> factory)
    • Method Detail

      • removeEntryListeners

        public void removeEntryListeners()
      • putAndShare

        public void putAndShare​(K key,
                                V value,
                                OortObject.Result<V> callback)

        Updates a single entry of the local entity map with the given key and value, and broadcasts the operation to all nodes in the cluster.

        Calling this method triggers notifications OortMap.EntryListeners, both on this node and on remote nodes.

        The entry is guaranteed to be put not when this method returns, but when the OortObject.Result parameter is notified.

        Parameters:
        key - the key to associate the value to
        value - the value associated with the key
        callback - the callback invoked with the old value, or null if there is no interest in the old value
        See Also:
        putIfAbsentAndShare(Object, Object, Result), removeAndShare(Object, Result)
      • putIfAbsentAndShare

        public void putIfAbsentAndShare​(K key,
                                        V value,
                                        OortObject.Result<V> callback)

        Updates a single entry of the local entity map with the given key and value if it does not exist yet, and broadcasts the operation to all nodes in the cluster.

        Calling this method triggers notifications OortMap.EntryListeners, both on this node and on remote nodes, only if the key did not exist.

        The entry is guaranteed to be put not when this method returns, but when the OortObject.Result parameter is notified.

        Parameters:
        key - the key to associate the value to
        value - the value associated with the key
        callback - the callback invoked with the old value, or null if there is no interest in the old value
        See Also:
        putAndShare(Object, Object, Result)
      • removeAndShare

        public void removeAndShare​(K key,
                                   OortObject.Result<V> callback)

        Removes the given key from the local entity map, and broadcasts the operation to all nodes in the cluster.

        Calling this method triggers notifications OortMap.EntryListeners, both on this node and on remote nodes.

        The entry is guaranteed to be removed not when this method returns, but when the OortObject.Result parameter is notified.

        Parameters:
        key - the key to remove
        callback - the callback invoked with the value, or null if there is no interest in the value
        See Also:
        putAndShare(Object, Object, Result)
      • get

        public V get​(K key)
        Returns the value mapped to the given key from the local entity map of this node. Differently from find(Object), only the local entity map is scanned.
        Parameters:
        key - the key mapped to the value to return
        Returns:
        the value mapped to the given key, or null if the local map does not contain the given key
        See Also:
        find(Object)
      • find

        public V find​(K key)
        Returns the first non-null value mapped to the given key from the entity maps of all nodes. Differently from get(Object), entity maps of all nodes are scanned.
        Parameters:
        key - the key mapped to the value to return
        Returns:
        the value mapped to the given key, or null if the maps do not contain the given key
        See Also:
        get(Object)
      • findInfo

        public OortObject.Info<java.util.concurrent.ConcurrentMap<K,​V>> findInfo​(K key)
        Parameters:
        key - the key to search
        Returns:
        the first OortObject.Info whose entity map contains the given key.
      • isItemUpdate

        protected boolean isItemUpdate​(java.util.Map<java.lang.String,​java.lang.Object> data)
        Specified by:
        isItemUpdate in class OortContainer<java.util.concurrent.ConcurrentMap<K,​V>>
      • onItem

        protected void onItem​(OortObject.Info<java.util.concurrent.ConcurrentMap<K,​V>> info,
                              java.util.Map<java.lang.String,​java.lang.Object> data)
        Specified by:
        onItem in class OortContainer<java.util.concurrent.ConcurrentMap<K,​V>>