coreRuntime/src/sc/sync/SyncManager.java
public void applyRemoteChanges(Object inst, Map<String,Object> pendingMap) {
         InstInfo ii = findSyncInstInfo(inst);
         if (ii.syncContext != this) {
            // Pretty sure we need to create this here (or perhaps sooner) so that we store the previous values for the
            // specific context that retrieved them. This seems to happen for say global objects which are not on-demand and
            // so not discovered in the context of a reference.
            ii = createInheritedInstInfo(inst, ii);
         }

         HashMap<String,Object> prevMap = ii.previousValues;
         HashMap<String,Object> initMap = ii.initialValues;

         // This is done lazily just as a performance optimization.   Many objects will never be changed so why have two HashMap's that keep parallel info in that case.  We do the simple copy-on-write here.  Waiting as long as we can - the first time we update the previous values from a different transaction.
         if (initMap == prevMap && prevMap != null) {
            initMap = (HashMap<String,Object>) prevMap.clone();
            ii.initialValues = initMap;
         }

         if (prevMap == null)
            ii.previousValues = prevMap = new HashMap<String,Object>();

         //if (trace) {
            //System.out.println("Applying: " + pendingMap.size() + " remote changes to: " + DynUtil.getInstanceName(inst));
         //}

         for (Map.Entry<String,Object> pendingPropEnt:pendingMap.entrySet()) {
            String propName = pendingPropEnt.getKey();
            Object propVal = pendingPropEnt.getValue();
            propVal = copyMutableValue(propVal);
            prevMap.put(propName, propVal);

            //if (trace) {
            //   System.out.println("  " + propName + " = " + DynUtil.getInstanceName(propVal));
            //}
         }
      }
/**
       * This method gets called with a list of changes that were successfully applied by the other side.  It essentially commits
       * these changes by populating the previousValues map - our record of the state of the objects on the other side.
       */
This method gets called with a list of changes that were successfully applied by the other side.  It essentially commits
these changes by populating the previousValues map - our record of the state of the objects on the other side.
This method gets called with a list of changes that were successfully applied by the other side . It essentially commits these changes by populating the previousValues map - our record of the state of the objects on the other side .
public void applyRemoteChanges(Object inst, Map<String,Object> pendingMap) {
         InstInfo ii = findSyncInstInfo(inst);
         if (ii.syncContext != this) {
            ii = createInheritedInstInfo(inst, ii);
         }
         HashMap<String,Object> prevMap = ii.previousValues;
         HashMap<String,Object> initMap = ii.initialValues;
         if (initMap == prevMap && prevMap != null) {
            initMap = (HashMap<String,Object>) prevMap.clone();
            ii.initialValues = initMap;
         }
         if (prevMap == null)
            ii.previousValues = prevMap = new HashMap<String,Object>();
         for (Map.Entry<String,Object> pendingPropEnt:pendingMap.entrySet()) {
            String propName = pendingPropEnt.getKey();
            Object propVal = pendingPropEnt.getValue();
            propVal = copyMutableValue(propVal);
            prevMap.put(propName, propVal);
         }
      }
public void applyRemoteChanges ( Object inst , Map < String , Object > pendingMap ) { InstInfo ii = findSyncInstInfo ( inst ) ; if ( ii . syncContext != this ) { ii = createInheritedInstInfo ( inst , ii ) ; } HashMap < String , Object > prevMap = ii . previousValues ; HashMap < String , Object > initMap = ii . initialValues ; if ( initMap == prevMap && prevMap != null ) { initMap = ( HashMap < String , Object > ) prevMap . clone ( ) ; ii . initialValues = initMap ; } if ( prevMap == null ) ii . previousValues = prevMap = new HashMap < String , Object > ( ) ; for ( Map . Entry < String , Object > pendingPropEnt : pendingMap . entrySet ( ) ) { String propName = pendingPropEnt . getKey ( ) ; Object propVal = pendingPropEnt . getValue ( ) ; propVal = copyMutableValue ( propVal ) ; prevMap . put ( propName , propVal ) ; } }
This method gets called with a list of changes that were successfully applied by the other side.
This method gets called with a list of changes that were successfully applied by the other side .
// Pretty sure we need to create this here (or perhaps sooner) so that we store the previous values for the // specific context that retrieved them. This seems to happen for say global objects which are not on-demand and // so not discovered in the context of a reference. // This is done lazily just as a performance optimization.   Many objects will never be changed so why have two HashMap's that keep parallel info in that case.  We do the simple copy-on-write here.  Waiting as long as we can - the first time we update the previous values from a different transaction. //if (trace) { //System.out.println("Applying: " + pendingMap.size() + " remote changes to: " + DynUtil.getInstanceName(inst)); //} //if (trace) { //   System.out.println("  " + propName + " = " + DynUtil.getInstanceName(propVal)); //}