From: Julio G. <ju...@us...> - 2004-07-09 17:31:03
|
Update of /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/sfcore/processcompound In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21361/smartfrog/src/org/smartfrog/sfcore/processcompound Modified Files: SFProcess.java Log Message: Added: resetRootProcessCompound method. Index: SFProcess.java =================================================================== RCS file: /cvsroot/smartfrog/core/smartfrog/src/org/smartfrog/sfcore/processcompound/SFProcess.java,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** SFProcess.java 2 Jul 2004 17:30:43 -0000 1.24 --- SFProcess.java 9 Jul 2004 17:30:54 -0000 1.25 *************** *** 30,35 **** import org.smartfrog.SFSystem; - //import org.smartfrog.sfcore.common.Context; - //import org.smartfrog.sfcore.common.ContextImpl; import org.smartfrog.sfcore.common.SmartFrogCoreKeys; import org.smartfrog.sfcore.common.SmartFrogCoreProperty; --- 30,33 ---- *************** *** 52,55 **** --- 50,54 ---- import org.smartfrog.sfcore.security.SFClassLoader; + import sun.misc.Signal; import sun.misc.SignalHandler; *************** *** 387,391 **** //deployDefaultProcessDescriptions((ProcessCompound)processCompound); - return processCompound; } --- 386,389 ---- *************** *** 393,396 **** --- 391,422 ---- + /** + * Resets the root process compound + * @param reference of terminatorCompleteName + * @return new root process compound + * + * @throws SmartFrogException if failed to deploy process compound, the root process compound didn't exist or ir the local process compound is not a root process compound + * + * @ TODO: test it! + */ + public static synchronized ProcessCompound resetRootProcessCompound(Reference terminatorCompleteName) + throws SmartFrogException,RemoteException { + if ((processCompound != null)&& processCompound.sfIsRoot()) { + //Terminate process compound but without system exit + processCompound.systemExitOnTermination(false); + TerminationRecord termR = new TerminationRecord("normal", + "Restarting ProcessCompound: "+ + processCompound.sfCompleteName(), terminatorCompleteName); + processCompound.sfAddAttribute("sfSyncTerminate",new Boolean(true)); + processCompound.sfTerminate(termR); + return deployProcessCompound(); + } + if (processCompound == null) { + throw new SmartFrogRuntimeException ("Process Compound cannot be reset: is null"); + }else { + throw new SmartFrogRuntimeException( + "Process Compound cannot be reset"); + } + } *************** *** 529,531 **** --- 555,558 ---- } + } |