Package com.sun.sgs.app

Examples of com.sun.sgs.app.DataManager.createReference()


      ListNode<E> n = new ListNode<E>(this, bucketSize, e);
      size = n.size();
      childrenCount = 1;
      DataManager dm = AppContext.getDataManager();
      childRef = dm.createReference((Node<E>) n);
      parentRef = createReferenceIfNecessary(parent);
  }

  /**
   * Constructor which creates a {@code TreeNode} while specifying
View Full Code Here


      if (!isSplit) {
    ListNode<E> n = new ListNode<E>(this, bucketSize);
    DataManager dm = AppContext.getDataManager();
    size = n.size();
    childRef = dm.createReference((Node<E>) n);
      } else {
    size = 0;
    childRef = null;
      }
      parentRef = createReferenceIfNecessary(parent);
View Full Code Here

   * @param root the root node of the entire tree structure
   */
  AsynchronousClearTask(ScalableList<E> list) {
      assert (list != null);
      DataManager dm = AppContext.getDataManager();
      current = dm.createReference(list.getHead());
  }

  /**
   * The entry point of the task to perform the clear.
   */
 
View Full Code Here

  dm.removeObject(leaf);

  // update the new children nodes to point to this directory node as
  // their parent
        ManagedReference<ScalableHashMap<K, V>> thisRef =
      dm.createReference(this);
  rightChildRef.get().parentRef = thisRef;
  leftChildRef.get().parentRef = thisRef;

  // how many bits in the prefix are significant for looking up the
  // old leaf
View Full Code Here

      // single KeyValuePair
      if (!(k instanceof ManagedObject) &&
    !(v instanceof ManagedObject))
      {
    setKeyValuePair();
    keyOrPairRef = dm.createReference(
        new ManagedSerializable<Object>(
                        new KeyValuePair<K, V>(k, v)));
      } else {
    // For the key and value, if each is already a ManagedObject,
    // then we obtain a ManagedReference to the object itself,
View Full Code Here

    // For the key and value, if each is already a ManagedObject,
    // then we obtain a ManagedReference to the object itself,
    // otherwise, we need to wrap it in a ManagedSerializable and
    // get a ManagedReference to that
    setKeyWrapped(!(k instanceof ManagedObject));
    keyOrPairRef = dm.createReference(
        isKeyWrapped() ? new ManagedSerializable<Object>(k) : k);
    setValueWrapped(!(v instanceof ManagedObject));
    valueRef = dm.createReference(
        isValueWrapped() ? new ManagedSerializable<V>(v) : v);
      }
View Full Code Here

    // get a ManagedReference to that
    setKeyWrapped(!(k instanceof ManagedObject));
    keyOrPairRef = dm.createReference(
        isKeyWrapped() ? new ManagedSerializable<Object>(k) : k);
    setValueWrapped(!(v instanceof ManagedObject));
    valueRef = dm.createReference(
        isValueWrapped() ? new ManagedSerializable<V>(v) : v);
      }
  }

  /** Returns whether the key and value are stored as a pair. */
 
View Full Code Here

        setKeyWrapped(true);
    } else if (isValueWrapped()) {
        dm.removeObject(valueRef.get());
        setValueWrapped(false);
    }
    valueRef = dm.createReference(newValue);
      } else if (isKeyValuePair()) {
                ManagedSerializable<KeyValuePair<K, V>> msPair =
        uncheckedCast(keyOrPairRef.get());
                dm.markForUpdate(msPair);
    msPair.get().setValue(newValue);
View Full Code Here

    setKeyValuePair();
      } else if (isValueWrapped()) {
    ManagedSerializable<V> ms = uncheckedCast(valueRef.get());
    ms.set(newValue);
      } else {
    valueRef = dm.createReference(
        new ManagedSerializable<V>(newValue));
    setValueWrapped(true);
      }
  }
View Full Code Here

        // must save a ManagedReference to the item.

        DataManager dataManager = AppContext.getDataManager();
        dataManager.markForUpdate(this);

        return items.add(dataManager.createReference(item));
    }

    /**
     * Adds a player to this room.
     *
 
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.