coreRuntime/src/sc/sync/SyncManager.java
public void addSyncInst(List<SyncLayer.SyncChange> depChanges, Object inst, boolean initInst, boolean onDemand, boolean initDefault, boolean resetState, boolean queueNewObj, boolean addPropChanges, int scopeId, SyncProperties syncProps, Object...args) {
         // We may have already registered this object with a parent scope cause the outer instance was not set when the object was created.
         clearParentSyncInst(inst, syncProps);

         if (verbose) // TODO: add some info here about locks held if we have verboseLocks set?
            System.out.println("Add sync inst: " + DynUtil.getInstanceName(inst) + " on thread: " +  DynUtil.getCurrentThreadString());

         InstInfo ii = syncInsts.get(inst);
         if (ii == null) {
            ii = new InstInfo(this, args, initDefault, resetState, onDemand);
            putInstInfo(inst, ii);
         }
         else {
            // Note: we might be updating the args here to a new value.  First the base class addSyncInst is called with it's args, and the last
            // addSyncInst call should be in the constructor used for the concrete class. We pass the InstInfo into the NewObj so it will see the
            // updated args we set here.
            if (args != null && args.length > 0) {
               ii.args = args;
            }
            ii.initDefault = ii.initDefault || initDefault;
            ii.onDemand = ii.onDemand || onDemand;
            ii.inherited = false;
            if (!resetState)
               ii.resetState = false;
         }
         ii.props = syncProps;

         if (!ii.initialized) {
            if (initInst) {
               initSyncInst(depChanges, inst, ii, initDefault, scopeId, syncProps, args, queueNewObj, false, addPropChanges, true, null);
            }
            // On-demand objects still need to have their names registered.  When the client needs to resync, it will try to set on-demand objects
            // which it has loaded but the server has not yet initialized.  We need the name at least to be able to find the instance and then create it on the fly.
            else if (ii.name == null && onDemand && needsInitialSync) {
               registerSyncInstName(depChanges, inst, ii, scopeId, syncProps, false);
            }
         }

         // When adding a new global object which is not marked as on-demand, go and add it to all of the child contexts.  This is the "push new record" operation and so must be synchronized against adding new sessions (though maybe change this to an
         if (!onDemand) {
            initChildContexts(ii, inst, args, syncProps, false);
         }
      }
/**
       * This is a lower-level method to add a new sync inst with the most flexibility.  Since it's defined on ScopeContext, it's called after you have selected the scope to manage
       * the lifecycle of this instance.
       * If depChanges is not null, any dependent changes required to initialize this instance are put into the provided depChanges list.  If depChanges is null, dependent changes are added to the end of the current SyncLayer of changes.
       * If initInst is false, we'll register the instance but won't initialize it with the sync system yet.
       * If onDemand is false, the instance is added explicitly to all sync contexts - they will be pushed to listeners on the scope involved
       * If queueNewObj is true, a 'new' or create object is added to the SyncLayer to create this instance on the remote side.
       * Otherwise, it's assumed the remote client will already have created the object, or a new obj has already been queued for this instance (or will be later).
       * Note that it's possible the parent context has already registered this instance due to a super-type call to addSyncInst (when queuing is disabled).
       * We'll add the instance to this sync context, then unless it's on-demand, we initialize it in all child-contexts so they sync it as well.
       */
This is a lower-level method to add a new sync inst with the most flexibility.  Since it's defined on ScopeContext, it's called after you have selected the scope to manage
the lifecycle of this instance.
If depChanges is not null, any dependent changes required to initialize this instance are put into the provided depChanges list.  If depChanges is null, dependent changes are added to the end of the current SyncLayer of changes.
If initInst is false, we'll register the instance but won't initialize it with the sync system yet.
If onDemand is false, the instance is added explicitly to all sync contexts - they will be pushed to listeners on the scope involved
If queueNewObj is true, a 'new' or create object is added to the SyncLayer to create this instance on the remote side.
Otherwise, it's assumed the remote client will already have created the object, or a new obj has already been queued for this instance (or will be later).
Note that it's possible the parent context has already registered this instance due to a super-type call to addSyncInst (when queuing is disabled).
We'll add the instance to this sync context, then unless it's on-demand, we initialize it in all child-contexts so they sync it as well.
This is a lower - level method to add a new sync inst with the most flexibility . Since it ' s defined on ScopeContext it ' s called after you have selected the scope to manage the lifecycle of this instance . If depChanges is not null any dependent changes required to initialize this instance are put into the provided depChanges list . If depChanges is null dependent changes are added to the end of the current SyncLayer of changes . If initInst is false we ' ll register the instance but won ' t initialize it with the sync system yet . If onDemand is false the instance is added explicitly to all sync contexts - they will be pushed to listeners on the scope involved If queueNewObj is true a ' new ' or create object is added to the SyncLayer to create this instance on the remote side . Otherwise it ' s assumed the remote client will already have created the object or a new obj has already been queued for this instance ( or will be later ) . Note that it ' s possible the parent context has already registered this instance due to a super - type call to addSyncInst ( when queuing is disabled ) . We ' ll add the instance to this sync context then unless it ' s on - demand we initialize it in all child - contexts so they sync it as well .
public void addSyncInst(List<SyncLayer.SyncChange> depChanges, Object inst, boolean initInst, boolean onDemand, boolean initDefault, boolean resetState, boolean queueNewObj, boolean addPropChanges, int scopeId, SyncProperties syncProps, Object...args) {
         clearParentSyncInst(inst, syncProps);
         if (verbose) 
            System.out.println("Add sync inst: " + DynUtil.getInstanceName(inst) + " on thread: " +  DynUtil.getCurrentThreadString());
         InstInfo ii = syncInsts.get(inst);
         if (ii == null) {
            ii = new InstInfo(this, args, initDefault, resetState, onDemand);
            putInstInfo(inst, ii);
         }
         else {
            if (args != null && args.length > 0) {
               ii.args = args;
            }
            ii.initDefault = ii.initDefault || initDefault;
            ii.onDemand = ii.onDemand || onDemand;
            ii.inherited = false;
            if (!resetState)
               ii.resetState = false;
         }
         ii.props = syncProps;
         if (!ii.initialized) {
            if (initInst) {
               initSyncInst(depChanges, inst, ii, initDefault, scopeId, syncProps, args, queueNewObj, false, addPropChanges, true, null);
            }
            else if (ii.name == null && onDemand && needsInitialSync) {
               registerSyncInstName(depChanges, inst, ii, scopeId, syncProps, false);
            }
         }
         if (!onDemand) {
            initChildContexts(ii, inst, args, syncProps, false);
         }
      }
public void addSyncInst ( List < SyncLayer . SyncChange > depChanges , Object inst , boolean initInst , boolean onDemand , boolean initDefault , boolean resetState , boolean queueNewObj , boolean addPropChanges , int scopeId , SyncProperties syncProps , Object ... args ) { clearParentSyncInst ( inst , syncProps ) ; if ( verbose ) System . out . println ( "Add sync inst: " + DynUtil . getInstanceName ( inst ) + " on thread: " + DynUtil . getCurrentThreadString ( ) ) ; InstInfo ii = syncInsts . get ( inst ) ; if ( ii == null ) { ii = new InstInfo ( this , args , initDefault , resetState , onDemand ) ; putInstInfo ( inst , ii ) ; } else { if ( args != null && args . length > 0 ) { ii . args = args ; } ii . initDefault = ii . initDefault || initDefault ; ii . onDemand = ii . onDemand || onDemand ; ii . inherited = false ; if ( ! resetState ) ii . resetState = false ; } ii . props = syncProps ; if ( ! ii . initialized ) { if ( initInst ) { initSyncInst ( depChanges , inst , ii , initDefault , scopeId , syncProps , args , queueNewObj , false , addPropChanges , true , null ) ; } else if ( ii . name == null && onDemand && needsInitialSync ) { registerSyncInstName ( depChanges , inst , ii , scopeId , syncProps , false ) ; } } if ( ! onDemand ) { initChildContexts ( ii , inst , args , syncProps , false ) ; } }
This is a lower-level method to add a new sync inst with the most flexibility.
This is a lower - level method to add a new sync inst with the most flexibility .
// We may have already registered this object with a parent scope cause the outer instance was not set when the object was created. // TODO: add some info here about locks held if we have verboseLocks set? // Note: we might be updating the args here to a new value.  First the base class addSyncInst is called with it's args, and the last // addSyncInst call should be in the constructor used for the concrete class. We pass the InstInfo into the NewObj so it will see the // updated args we set here. // On-demand objects still need to have their names registered.  When the client needs to resync, it will try to set on-demand objects // which it has loaded but the server has not yet initialized.  We need the name at least to be able to find the instance and then create it on the fly. // When adding a new global object which is not marked as on-demand, go and add it to all of the child contexts.  This is the "push new record" operation and so must be synchronized against adding new sessions (though maybe change this to an