cometd-java/cometd-java-oort/src/main/java/org/cometd/oort/OortMap.java
/**
     * <p>Updates a single entry of the local entity map with the given {@code key} and {@code value}
     * if it does not exist yet, and broadcasts the operation to all nodes in the cluster.</p>
     * <p>Calling this method triggers notifications {@link EntryListener}s, both on this node and on remote nodes,
     * only if the key did not exist.</p>
     * <p>The entry is guaranteed to be put not when this method returns,
     * but when the {@link Result} parameter is notified.</p>
     *
     * @param key      the key to associate the value to
     * @param value    the value associated with the key
     * @param callback the callback invoked with the old value,
     *                 or {@code null} if there is no interest in the old value
     * @see #putAndShare(Object, Object, Result)
     */
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  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  Result parameter is notified.

@param key      the key to associate the value to
@param value    the value associated with the key
@param callback the callback invoked with the old value,
or  null if there is no interest in the old value
@see #putAndShare(Object, Object, Result)
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 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 Result parameter is notified . @param key the key to associate the value to @param value the value associated with the key @param callback the callback invoked with the old value or null if there is no interest in the old value @see #putAndShare ( Object Object Result )
public void putIfAbsentAndShare(K key, V value, Result<V> callback) {
        Map<String, Object> entry = new HashMap<>(2);
        entry.put(KEY_FIELD, key);
        entry.put(VALUE_FIELD, value);
        Data<V> data = new Data<>(6, callback);
        data.put(Info.OORT_URL_FIELD, getOort().getURL());
        data.put(Info.NAME_FIELD, getName());
        data.put(Info.OBJECT_FIELD, entry);
        data.put(Info.TYPE_FIELD, TYPE_FIELD_ENTRY_VALUE);
        data.put(Info.ACTION_FIELD, ACTION_FIELD_PUT_ABSENT_VALUE);
        if (logger.isDebugEnabled()) {
            logger.debug("Sharing map putIfAbsent {}", data);
        }
        BayeuxServer bayeuxServer = getOort().getBayeuxServer();
        bayeuxServer.getChannel(getChannelName()).publish(getLocalSession(), data, Promise.noop());
    }
public void putIfAbsentAndShare ( K key , V value , Result < V > callback ) { Map < String , Object > entry = new HashMap < > ( 2 ) ; entry . put ( KEY_FIELD , key ) ; entry . put ( VALUE_FIELD , value ) ; Data < V > data = new Data < > ( 6 , callback ) ; data . put ( Info . OORT_URL_FIELD , getOort ( ) . getURL ( ) ) ; data . put ( Info . NAME_FIELD , getName ( ) ) ; data . put ( Info . OBJECT_FIELD , entry ) ; data . put ( Info . TYPE_FIELD , TYPE_FIELD_ENTRY_VALUE ) ; data . put ( Info . ACTION_FIELD , ACTION_FIELD_PUT_ABSENT_VALUE ) ; if ( logger . isDebugEnabled ( ) ) { logger . debug ( "Sharing map putIfAbsent {}" , data ) ; } BayeuxServer bayeuxServer = getOort ( ) . getBayeuxServer ( ) ; bayeuxServer . getChannel ( getChannelName ( ) ) . publish ( getLocalSession ( ) , data , Promise . noop ( ) ) ; }
<p>Updates a single entry of the local entity map with the given {@code key} and {@code value}
 if it does not exist yet, and broadcasts the operation to all nodes in the cluster.</p>
 <p>Calling this method triggers notifications {@link EntryListener}s, both on this node and on remote nodes,
 only if the key did not exist.</p>
 <p>The entry is guaranteed to be put not when this method returns,
 but when the {@link Result} parameter is notified.</p>
<p > Updates a single entry of the local entity map with the given { @code key } and { @code value } if it does not exist yet and broadcasts the operation to all nodes in the cluster . < / p > <p > Calling this method triggers notifications { @link EntryListener } s both on this node and on remote nodes only if the key did not exist . < / p > <p > The entry is guaranteed to be put not when this method returns but when the { @link Result } parameter is notified . < / p >