Package com.sun.sgs.app

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


  // lastly, fill the directory with the references
  int pos = 0;
  for (ScalableHashMap leaf : leaves) {
      int nextPos = pos + entriesPerLeaf;
      Arrays.fill(nodeDirectory, pos, nextPos, dm.createReference(leaf));
      pos = nextPos;
  }

  /* Make sure the leaves have the minimum required depth. */
  for (ScalableHashMap leaf : leaves) {
View Full Code Here


  setDirectoryNode();
  size = 0;

  // create the references to the new children
        ManagedReference<ScalableHashMap<K, V>> leftChildRef =
                dataManager.createReference(leftChild);
        ManagedReference<ScalableHashMap<K, V>> rightChildRef =
                dataManager.createReference(rightChild);

  if (leftLeafRef != null) {
            ScalableHashMap<K, V> leftLeaf = leftLeafRef.get();
View Full Code Here

  // create the references to the new children
        ManagedReference<ScalableHashMap<K, V>> leftChildRef =
                dataManager.createReference(leftChild);
        ManagedReference<ScalableHashMap<K, V>> rightChildRef =
                dataManager.createReference(rightChild);

  if (leftLeafRef != null) {
            ScalableHashMap<K, V> leftLeaf = leftLeafRef.get();
      leftLeaf.rightLeafRef = leftChildRef;
      leftChild.leftLeafRef = leftLeafRef;
View Full Code Here

      depth % maxDirBits == 0 ||
      depth == minDepth) {

      // this leaf node will become a directory node
            ManagedReference<ScalableHashMap<K, V>> thisRef =
    dataManager.createReference(this);
      rightChild.parentRef = thisRef;
      leftChild.parentRef = thisRef;

      setDirectoryNode();
      nodeDirectory = new ManagedReference[1 << getNodeDirBits()];
View Full Code Here

  dm.markForUpdate(this);

  // 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());
    msPair.get().setValue(newValue);
      } else if (isKeyWrapped()) {
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

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.