Package com.sun.sgs.app

Examples of com.sun.sgs.app.DataManager


         *
         * @code prev the {@code Element} before this {@code Element}
         *       in the deque
         */
        void setPrev(Element<E> prev) {
            DataManager dm = AppContext.getDataManager();
            ManagedReference<Element<E>> ref =
                    (prev == null) ? null : dm.createReference(prev);

            dm.markForUpdate(this);
            prevElement = ref;
        }
View Full Code Here


    public String getIDFor(ProximityListenerSrv listener) {
        // issue #1101: if the listener is a managed object, generate
        // and ID based on the ID of the underlying managed object.
        if (listener instanceof ManagedObject) {
            DataManager dm = AppContext.getDataManager();
            return cellID + "." + dm.createReference(listener).getId();
        } else {
            // the object is not a managed object, so return a newly assigned
            // id
            return cellID + "." + nextID++;
        }
View Full Code Here

  // Schedule asynchronous task here
  // which will delete the list
  AppContext.getTaskManager().scheduleTask(clearTask);

  // Remove the dummy connectors
  DataManager dm = AppContext.getDataManager();
  dm.removeObject(headRef.get());
  dm.removeObject(tailRef.get());
    }
View Full Code Here

        private String id;

        public ManagedProximityListenerWrapper(ProximityListenerSrv listener, String id) {
            this.id = id;

            DataManager dm = AppContext.getDataManager();
            dm.setBinding(BINDING_NAME + id, listener);
        }
View Full Code Here

     * regarding the structure's performance.
     */
    public ScalableDeque() {
        backingMap = new ScalableHashMap<Element<E>, Long>();

        DataManager dm = AppContext.getDataManager();
        backingMapRef = dm.createReference(backingMap);

        // initialize the pointers to the front and end of the deque
        // to null.  However, the reference to these pointers will
        // always be non-null
        ManagedSerializable<ManagedReference<Element<E>>> head =
                new ManagedSerializable<ManagedReference<Element<E>>>(null);
        ManagedSerializable<Long> headCount =
                new ManagedSerializable<Long>(-1L);

        ManagedSerializable<ManagedReference<Element<E>>> tail =
                new ManagedSerializable<ManagedReference<Element<E>>>(null);
        ManagedSerializable<Long> tailCount =
                new ManagedSerializable<Long>(0L);

        headElement = dm.createReference(head);
        headCounter = dm.createReference(headCount);
        tailElement = dm.createReference(tail);
        tailCounter = dm.createReference(tailCount);
    }
View Full Code Here

        updateWorldBounds(worldTransform);
    }

    void setLive(boolean isLive, final CellMO cell, UniverseManager mgr) {
        DataManager dm = AppContext.getDataManager();

        if (isLive) {
            Map<CellID, Integer> indexMap = new ScalableHashMap<CellID, Integer>();
            dm.setBinding(BINDING_NAME + id, indexMap);

            mgr.addTransformChangeListener(cell, this);
            mgr.addViewUpdateListener(cell, this);

            // issue #727: if the cell has not yet been added (because the job
            // to add it is scheduled but hasn't run), this may return null.
            // In that case, just return, since the listener will be notified
            // with the actual bounds once the cell is fully inserted into the
            // world
            CellTransform worldTransform = cell.getWorldTransform(null);
            if (worldTransform != null) {
                // Issue #721: we need to set the transform to the cell's transform
                // here, since the cell may already exist and we can't count on
                // getting a transform changed notification until the cell moves
                updateWorldBounds(worldTransform);
            }
        } else {
            mgr.removeTransformChangeListener(cell, this);
            mgr.removeViewUpdateListener(cell, this);

            try {
                dm.removeBinding(BINDING_NAME + id);
            } catch (NameNotBoundException nnbe) {
                // we can safely ignore this -- this just means the component
                // is being added before the cell is live, so the first time
                // setLive is called, the binding hasn't been created
                logger.log(Level.FINE, null, nnbe);
View Full Code Here

     *
     * @param e the new head {@code Element}.
     */
    private void addToHead(Element<E> e) {

        DataManager dm = AppContext.getDataManager();

        // short-circuit case if this element is the only element in
        // the deque (i.e. the deque was empty)
        if (headElement.get().get() == null) {
            ManagedReference<Element<E>> ref = dm.createReference(e);
            headElement.get().set(ref);
            tailElement.get().set(ref);
            return;
        }

        Element<E> oldHead = headElement();
        headElement.get().set(dm.createReference(e));
        e.setPrev(null);
        e.setNext(oldHead);
        oldHead.setPrev(e);
    }
View Full Code Here

     *
     * @param e the new tail {@code Element}.
     */
    private void addToTail(Element<E> e) {

        DataManager dm = AppContext.getDataManager();

        // short-circuit case if this element is the only element in
        // the deque (i.e. the deque was empty)
        if (tailElement.get().get() == null) {
            ManagedReference<Element<E>> ref = dm.createReference(e);
            headElement.get().set(ref);
            tailElement.get().set(ref);
            return;
        }

        Element<E> oldTail = tailElement();
        tailElement.get().set(dm.createReference(e));
        e.setPrev(oldTail);
        e.setNext(null);
        oldTail.setNext(e);
    }
View Full Code Here

        if (o == null || !(o instanceof ScalableDeque)) {
            return false;
        }
        ScalableDeque<E> d = uncheckedCast(o);
        DataManager dm = AppContext.getDataManager();
        return dm.createReference(this).equals(dm.createReference(d));
    }
View Full Code Here

       
        // update the references to the front and back of the list, if
        // necessary.  We rely on the invariants that the previous and
        // next element references will only be null if an element is
        // at an end of the list.
        DataManager dm = AppContext.getDataManager();
        if (e.prevElement == null) {
            headElement.get().set((next == null)
                                  ? null : dm.createReference(next));
        }
        if (e.nextElement == null) {
            tailElement.get().set((prev == null)
                                  ? null : dm.createReference(prev));
        }
        AppContext.getDataManager().removeObject(e);

        return value;
    }
View Full Code Here

TOP

Related Classes of com.sun.sgs.app.DataManager

Copyright © 2018 www.massapicom. 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.