Package org.jdesktop.wonderland.modules.sharedstate.common

Examples of org.jdesktop.wonderland.modules.sharedstate.common.SharedData


        @Override
        public SharedData get(Object key) {
            // if there are pending asynchronous tasks, check those first
            MapTaskRunner async = getTaskRunner();
            if (async != null) {
                SharedData value = async.get((String) key);
                if (!(value instanceof SharedDataNoEffect)) {
                    return value;
                }
            }
           
View Full Code Here


         * are notified, and a message is sent to remote clients.
         */
        boolean put(WonderlandClientID senderID, PutRequestMessage message)
        {
            String key = message.getPropertyName();
            SharedData value =  message.getPropertyValue();
            SharedData prev = get(key);

            // notify listeners, see if they veto
            if (firePropertyChange(senderID, message, key, prev, value)) {
                asyncDoPut(senderID, key, value);
                return true;
View Full Code Here

                                     SharedData value, boolean notifyIfEqual)
        {
            version++;
       
            // make sure this is actually a change before sending any messages
            SharedData current = super.put(key, value);
            if (!notifyIfEqual && value.equals(current)) {
                // no change
                return value;
            }
           
View Full Code Here

         */
        boolean remove(WonderlandClientID senderID,
                       RemoveRequestMessage message)
        {
            String key = message.getPropertyName();
            SharedData prev = get(key);

            // notify listeners, see if they veto
            if (firePropertyChange(senderID, message, key, prev, null)) {
                asyncDoRemove(senderID, key);
                return true;
View Full Code Here

            return syncDoRemove(senderID, key);
        }
       
        private SharedData syncDoRemove(WonderlandClientID senderID, String key) {
            // make sure there is a value to remove before sending any messages
            SharedData prev = super.remove(key);
            if (prev == null) {
                return null;
            }
           
            version++;
View Full Code Here

        synchronized void setVersion(long version) {
            this.version = version;
        }

        public SharedData get() {
            SharedData out = null;

            // if the future does not yet exist, create it
            synchronized (this) {
                if (future == null) {
                    future = executor.submit(new ValueGetter(key));
View Full Code Here

                return null;
            }
        }

        public SharedData clear(SharedData newVal) {
            SharedData out = null;
            setReplacement(newVal);

            if (future != null) {
                if (future.isDone()) {
                    out = get();
View Full Code Here

        checkInit();

        final String key = (String) keyObj;

        // remove the value from the map
        SharedData prev = backing.removeLocal(key);

        // send the request for a change, and revert if there is an error
        channel.send(new RemoveRequestMessage(getName(), key),
                new OKErrorResponseListener()
        {
View Full Code Here

            // add the previous version to the reversion list
            addToReversionList(key, prev);

            // store the previous value, and then clear the result so
            // anyone waiting on the previous value will get this replacement
            SharedData prevVal = null;
            if (prev != null) {
                prevVal = prev.peek();
                prev.clear(value);
            }
View Full Code Here

                    prev = revert;
                }
            }

            // notify listeners
            SharedData prevData = (prev == null) ? null : prev.peek();
            firePropertyChange(senderID, key, prevData, data);
        }
View Full Code Here

TOP

Related Classes of org.jdesktop.wonderland.modules.sharedstate.common.SharedData

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.