|
SmartFrog 3.10.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.smartfrog.sfcore.reference.RemoteReferenceResolverHelperImpl
org.smartfrog.sfcore.prim.PrimImpl
org.smartfrog.sfcore.compound.CompoundImpl
org.smartfrog.sfcore.processcompound.ProcessCompoundImpl
public class ProcessCompoundImpl
Implements deployment behaviour for a process. There is a single process compound allowed per process. SFSystem asks SFProcess to make the processcompound on startup. SFProcess also holds the logic for making a process compound a root for a host. A single root process compound (defined as owning a particular port) is allowed per host. Every processcompound tries to locate its parent on deployment, if there is none, it tries to become the root of the host.
Through the deployer class used for primitives "PrimProcessDeployerImpl" the registration of components on deployment is guaranteed. A component being registered only means that the component is known to the process compound and will receive liveness from it. When the process compound is asked to terminate (ie. asked to terminate the process) all components are terminated.
You do not need to instantiate this class in order to get new processes. In your component description that you want to deploy, simply define sfProcessName with a string name of the processname that you want to deploy your component in. If the process does not exist, and processes are allowed by the root compound on the host, the process will be created and your component deployed.
| Field Summary | |
|---|---|
protected int |
countdown
The countdown to check the gcTimeout. |
protected int |
gcTimeout
On liveness check on a process compound checks if it has any components registered. |
protected java.util.Set |
processLocks
A set that contains the names of the sub-processes that have been requested, but not yet ready |
static long |
registrationNumber
A number used to generate a unique ID for registration |
protected boolean |
sfIsRoot
Whether the process is a Root (whether is starts and registers with a registry). |
protected java.lang.String |
sfProcessName
Name of this processcompound. |
protected boolean |
systemExit
Whether the ProcessCompound should cause the JVM to exit on termination. |
| Fields inherited from class org.smartfrog.sfcore.compound.CompoundImpl |
|---|
childCap, childInc, lifecycleChildren, sfChildren, sfSyncTerminate |
| Fields inherited from class org.smartfrog.sfcore.prim.PrimImpl |
|---|
refLivenessDelay, refLivenessFactor, sfCompleteName, sfContext, sfDeployHooks, sfDeployWithHooks, sfExportRef, sfIsDeployed, sfIsStarted, sfIsTerminated, sfIsTerminating, sfLivenessCount, sfLivenessDelay, sfLivenessFactor, sfLivenessSender, sfParent, sfStartHooks, sfTerminateWithHooks, termLock |
| Constructor Summary | |
|---|---|
ProcessCompoundImpl()
|
|
| Method Summary | |
|---|---|
protected ProcessCompound |
addNewProcessCompound(java.lang.Object name,
ComponentDescription cd)
Checks is sub-processes are allowed through attribute system property sfProcessAllow and checks that it is the root process compound. |
protected void |
addProcessAttributes(java.util.Vector cmd,
java.lang.Object name,
ComponentDescription cd)
Constructs sequence of -D statements for the new sub-process by iterating over the sfProcessConfig ComponentDescription. |
protected void |
addProcessClassName(java.util.Vector cmd,
ComponentDescription cd)
Get the class name for the subprocess. |
protected void |
addProcessClassPath(java.util.Vector cmd,
java.lang.Object name,
ComponentDescription cd)
Gets the current class path out of the system properties and returns it as a command line parameter for the subprocess. |
protected void |
addProcessDefines(java.util.Vector cmd,
java.lang.Object name)
Constructs sequence of -D statements for the new sub-process by iterating over the current process' properties and looking for those prefixed by org.smartfrog (and not security properties) and creating an entry for each of these. |
protected void |
addProcessEnvVars(java.util.Vector cmd,
ComponentDescription cd)
Constructs sequence of -D statements for the new sub-process by iterating over the sfProcessEnvVars ComponentDescription |
protected void |
addProcessJava(java.util.Vector cmd,
ComponentDescription cd)
Gets the process java start command. |
protected void |
addProcessSFCodeBase(java.util.Vector cmd,
java.lang.Object name,
ComponentDescription cd)
Gets the current org.smartfrog.codebase out of the system properties and returns it as a command line parameter for the subprocess. |
protected void |
registerWithProcessCompound()
Registers component with local ProcessCompound only if it is root component, its parent is remote or the attribute sfProcessComponentName is defined. |
protected void |
sfASyncTerminateWith(TerminationRecord status)
Terminate children asynchronously using a seperate thread for each call. |
Reference |
sfCompleteName()
Returns the complete name for this component from the root of the application. |
Prim |
sfDeployComponentDescription(java.lang.Object name,
Prim parent,
ComponentDescription cmp,
Context parms)
Override standard compound behaviour to register all components that go throug here as a child compound. |
void |
sfDeployWith(Prim parent,
Context cxt)
Creates itself as the right form of process: root, sub or independant. |
boolean |
sfDeRegister(Prim comp)
DeRegisters a deployed component |
void |
sfDetach()
Detach the process compound from its parent. |
protected java.lang.Object |
sfExport(java.lang.Object portObj)
Exports this component using portObj. |
boolean |
sfIsRoot()
Test whether the Process Compound is the root process compound or not. |
void |
sfLivenessFailure(java.lang.Object source,
java.lang.Object target,
java.lang.Throwable failure)
Override liveness sending failures to just remove component from table, Does NOT to call termination since a child terminating does not mean that this proces should die. |
protected ProcessCompound |
sfLocateParent()
Locate the parent process compound. |
void |
sfNotifySubprocessReady(java.lang.String name)
Allows a sub-process to notify the root process compound that it is now ready to receive deployment requests. |
void |
sfPing(java.lang.Object source)
Implements ping for a compound. |
java.lang.String |
sfProcessName()
Returns the processname for this process. |
java.lang.Object |
sfRegister(java.lang.Object name,
Prim comp)
Register a component under given name. |
protected void |
sfRegisterWithParent(ProcessCompound parent)
Parent process compoound can not add me to the attribute list since he did not create me. |
java.lang.Object |
sfResolveHereOrWait(java.lang.Object name,
long timeout)
Tries to find an attribute in the local context. |
ProcessCompound |
sfResolveProcess(java.lang.Object name,
ComponentDescription cd)
Find a process for a given name in the root process compound. |
void |
sfStart()
Starts the process compound. |
protected void |
sfSyncTerminateWith(TerminationRecord status)
Iterates over children telling each of them to terminate quietly with given status. |
void |
sfTerminatedWith(TerminationRecord rec,
Prim comp)
Process compound sub-component termination policy is currently not to terminate itself (which is default compound behaviour. |
void |
sfTerminateWith(TerminationRecord rec)
Termination call. |
protected java.lang.Process |
startProcess(java.lang.Object name,
ComponentDescription cd)
Does the work of starting up a new process. |
void |
systemExitOnTermination(boolean exit)
Sets whether or not the ProcessCompound should terminate the JVM on exit. |
| Methods inherited from class org.smartfrog.sfcore.compound.CompoundImpl |
|---|
sfAddChild, sfChildren, sfContainsChild, sfCreateNewApp, sfCreateNewChild, sfCreateNewChild, sfDeploy, sfDeployChildren, sfDeployWithChildren, sfDumpState, sfParentageChanged, sfPingChild, sfRemoveAttribute, sfRemoveChild, sfStartChildren |
| Methods inherited from class org.smartfrog.sfcore.reference.RemoteReferenceResolverHelperImpl |
|---|
sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolveWithParser |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface org.smartfrog.sfcore.compound.Compound |
|---|
sfCreateNewApp, sfCreateNewChild, sfCreateNewChild |
| Methods inherited from interface org.smartfrog.sfcore.prim.Prim |
|---|
sfAddAttribute, sfAttributeKeyFor, sfAttributes, sfContainsAttribute, sfContainsValue, sfContext, sfDeploy, sfDeployedHost, sfDeployedProcessName, sfDetachAndTerminate, sfDumpState, sfIsDeployed, sfIsStarted, sfIsTerminated, sfIsTerminating, sfParent, sfParentageChanged, sfRemoveAttribute, sfReplaceAttribute, sfTerminate, sfTerminateQuietlyWith, sfValues |
| Methods inherited from interface org.smartfrog.sfcore.reference.RemoteReferenceResolver |
|---|
sfResolve, sfResolve, sfResolveHere, sfResolveHere, sfResolveParent |
| Methods inherited from interface org.smartfrog.sfcore.reference.RemoteReferenceResolverHelper |
|---|
sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolve, sfResolveWithParser |
| Methods inherited from interface org.smartfrog.sfcore.prim.Diagnostics |
|---|
sfDiagnosticsReport |
| Methods inherited from interface org.smartfrog.sfcore.prim.ChildMinder |
|---|
sfAddChild, sfChildren, sfContainsChild, sfRemoveChild |
| Field Detail |
|---|
public static long registrationNumber
protected java.lang.String sfProcessName
protected boolean sfIsRoot
protected boolean systemExit
protected int gcTimeout
protected int countdown
protected java.util.Set processLocks
| Constructor Detail |
|---|
public ProcessCompoundImpl()
throws java.rmi.RemoteException
java.rmi.RemoteException| Method Detail |
|---|
public boolean sfIsRoot()
throws java.rmi.RemoteException
sfIsRoot in interface ProcessCompoundjava.rmi.RemoteException - In case of network/rmi error
protected void sfRegisterWithParent(ProcessCompound parent)
throws SmartFrogException
parent - parent process compound to register with
SmartFrogException - failed to register with parent
protected ProcessCompound sfLocateParent()
throws SmartFrogException,
java.rmi.RemoteException
java.rmi.RemoteException - In case of network/rmi error
SmartFrogException - In case of SmartFrog system error
public Prim sfDeployComponentDescription(java.lang.Object name,
Prim parent,
ComponentDescription cmp,
Context parms)
throws SmartFrogDeploymentException
sfDeployComponentDescription in interface CompoundsfDeployComponentDescription in class CompoundImplname - name to name deployed component under in contextparent - of deployer componentcmp - compiled component to deployparms - parameters for description
SmartFrogDeploymentException - failed to deploy compiled
component
public void sfDeployWith(Prim parent,
Context cxt)
throws SmartFrogDeploymentException,
java.rmi.RemoteException
sfDeployWith in interface PrimsfDeployWith in class CompoundImplparent - parent prim. always null (and ignored) for this componentcxt - context for deployement
java.rmi.RemoteException - In case of network/rmi error
SmartFrogDeploymentException - In case of any error while
deploying the component
protected java.lang.Object sfExport(java.lang.Object portObj)
throws java.rmi.RemoteException,
java.rmi.RemoteException,
SmartFrogException
sfExport in class PrimImplportObj - Object
java.rmi.RemoteException
java.rmi.RemoteException
SmartFrogException
protected void registerWithProcessCompound()
throws java.rmi.RemoteException,
SmartFrogException
PrimImpl
registerWithProcessCompound in class PrimImpljava.rmi.RemoteException - In case of Remote/nework error
SmartFrogException - if failed to register
public void sfStart()
throws SmartFrogException,
java.rmi.RemoteException
sfStart in interface PrimsfStart in class CompoundImplSmartFrogException - failed to start compound
java.rmi.RemoteException - In case of Remote/nework error
public void sfTerminatedWith(TerminationRecord rec,
Prim comp)
sfTerminatedWith in interface PrimsfTerminatedWith in class CompoundImplrec - termination recordcomp - component that terminated
public void sfLivenessFailure(java.lang.Object source,
java.lang.Object target,
java.lang.Throwable failure)
sfLivenessFailure in class PrimImplsource - sender that failedtarget - target for the failurefailure - The errorpublic void sfTerminateWith(TerminationRecord rec)
sfTerminateWith in class CompoundImplrec - termination recordprotected void sfSyncTerminateWith(TerminationRecord status)
sfSyncTerminateWith in class CompoundImplstatus - status to terminate withprotected void sfASyncTerminateWith(TerminationRecord status)
sfASyncTerminateWith in class CompoundImplstatus - status to terminate with
public void systemExitOnTermination(boolean exit)
throws java.rmi.RemoteException
systemExitOnTermination in interface ProcessCompoundexit - whether or not to exit (true = exit)
java.rmi.RemoteException - In case of network/rmi error
public void sfDetach()
throws SmartFrogException,
java.rmi.RemoteException
sfDetach in interface PrimsfDetach in class PrimImplSmartFrogException - failed detaching process compound
java.rmi.RemoteException - In case of network/rmi error
public void sfPing(java.lang.Object source)
throws SmartFrogLivenessException,
java.rmi.RemoteException
CompoundImpl
sfPing in interface LivenesssfPing in class CompoundImplsource - source of ping
SmartFrogLivenessException - liveness failed
java.rmi.RemoteException - for consistency with the Liveness interfacepublic java.lang.String sfProcessName()
sfProcessName in interface ProcessCompound
public Reference sfCompleteName()
throws java.rmi.RemoteException
sfCompleteName in interface PrimsfCompleteName in class PrimImpljava.rmi.RemoteException - In case of network/rmi error
public java.lang.Object sfRegister(java.lang.Object name,
Prim comp)
throws SmartFrogException,
java.rmi.RemoteException
sfRegister in interface ProcessCompoundname - name for component or null for made up namecomp - component to register
SmartFrogException - In case of resolution failure
java.rmi.RemoteException - In case of network/rmi error
public boolean sfDeRegister(Prim comp)
throws SmartFrogException,
java.rmi.RemoteException
sfDeRegister in interface ProcessCompoundcomp - component to register
SmartFrogException - when component was not registered
java.rmi.RemoteException - In case of network/rmi error
public java.lang.Object sfResolveHereOrWait(java.lang.Object name,
long timeout)
throws java.lang.Exception
sfResolveHereOrWait in interface ProcessCompoundname - name of attribute to wait fortimeout - max time to wait in millis
java.lang.Exception - attribute not found after timeout
java.rmi.RemoteException - if there is any network or remote error
public void sfNotifySubprocessReady(java.lang.String name)
throws java.rmi.RemoteException
sfNotifySubprocessReady in interface ProcessCompoundname - the name of the subprocess
java.rmi.RemoteException - if there is any network or remote error
public ProcessCompound sfResolveProcess(java.lang.Object name,
ComponentDescription cd)
throws java.lang.Exception
sfResolveProcess in interface ProcessCompoundname - name of processcd - component description with extra process configuration (ex. sfProcessAttributes)
java.lang.Exception - failed to deploy process
protected ProcessCompound addNewProcessCompound(java.lang.Object name,
ComponentDescription cd)
throws java.lang.Exception
name - name of new compound
java.lang.Exception - failed to deploy new naming compound
protected java.lang.Process startProcess(java.lang.Object name,
ComponentDescription cd)
throws java.lang.Exception
name - name of new processcd - component description with extra process configuration (ex. sfProcessConfig)
java.lang.Exception - failed to locate all attributes, or start process
protected void addProcessJava(java.util.Vector cmd,
ComponentDescription cd)
throws java.lang.Exception
cmd - cmd to append tocd - component description with extra process configuration (ex. sfProcessConfig)
java.lang.Exception - failed to construct java command
protected void addProcessClassName(java.util.Vector cmd,
ComponentDescription cd)
throws java.lang.Exception
cmd - command to append tocd - component description with extra process configuration (ex. sfProcessClass)
java.lang.Exception - failed to construct classname
protected void addProcessClassPath(java.util.Vector cmd,
java.lang.Object name,
ComponentDescription cd)
throws java.lang.Exception
cmd - command to append roname - process namecd - component description with extra process configuration
java.lang.Exception - failed to construct classpath
protected void addProcessSFCodeBase(java.util.Vector cmd,
java.lang.Object name,
ComponentDescription cd)
throws java.lang.Exception
cmd - command to append roname - process namecd - component description with extra process configuration
java.lang.Exception - failed to construct classpath
protected void addProcessDefines(java.util.Vector cmd,
java.lang.Object name)
throws java.lang.Exception
cmd - command to append toname - name for subprocess
java.lang.Exception - failed to construct defines
protected void addProcessAttributes(java.util.Vector cmd,
java.lang.Object name,
ComponentDescription cd)
throws java.lang.Exception
cmd - command to append tocd - component description with extra process configuration (ex. sfProcessConfig)
java.lang.Exception - failed to construct defines
protected void addProcessEnvVars(java.util.Vector cmd,
ComponentDescription cd)
throws java.lang.Exception
cmd - command to append tocd - component description with extra process configuration (ex. sfProcessConfig)
java.lang.Exception - failed to construct defines
|
SmartFrog CORE 3.10.000 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||