main/src/main/java/org/onap/policy/pap/main/comm/QueueToken.java
/**
     * Replaces the token's item. If the current item is {@code null}, then it is left
     * unchanged.
     *
     * @param newItem the new item
     * @return the original item
     */
Replaces the token's item. If the current item is  null, then it is left
unchanged.

@param newItem the new item
@return the original item
Replaces the token ' s item . If the current item is null then it is left unchanged . @param newItem the new item @return the original item
public T replaceItem(T newItem) {
        T oldItem;
        while ((oldItem = ref.get()) != null) {
            if (ref.compareAndSet(oldItem, newItem)) {
                break;
            }
        }
        return oldItem;
    }
public T replaceItem ( T newItem ) { T oldItem ; while ( ( oldItem = ref . get ( ) ) != null ) { if ( ref . compareAndSet ( oldItem , newItem ) ) { break ; } } return oldItem ; }
Replaces the token's item.
Replaces the token ' s item .
// it was already null, or we successfully replaced the item