Class SpawnService
java.lang.Object
com.kosdev.kos.core.service.spawn.SpawnService
Service that is used to start/stop native programs on this node or other
nodes using a spawn session. All programs started by this service are
monitored and will be restarted using a backoff algorithm if they crash.
This is the preferred way to start long-running programs on the current
node or nodes that don't run Java.
- Since:
- 1
- Version:
- 1
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddProcess(SpawnProcess process) Add a process to the spawn list.voidaddProcess(SpawnProcess process, NodeId nodeId) Add a process to the spawn list.getProcesses(NodeId nodeId) Return a list of processes that are currently expected to be running on the specified node.voidremoveProcess(SpawnProcess process) Remove a process from the spawn list.voidrestartProcess(SpawnProcess process) Restart the specified process.voidsetPriority(SpawnProcess process, int priority) Set the priority of the specified process.
-
Method Details
-
addProcess
Add a process to the spawn list. If there is already an iface to the node then the process will be started immediately, otherwise it will start once the iface is established.- Parameters:
process- the process that should be runnodeId- the node to run the process on- Since:
- 1
-
addProcess
Add a process to the spawn list. If there is already an iface to the node then the process will be started immediately, otherwise it will start once the iface is established. This will be run on the local node.- Parameters:
process- the process that should be run- Since:
- 1
-
removeProcess
Remove a process from the spawn list. If it is running, it will be killed.- Parameters:
process- the process to remove- Since:
- 1
-
restartProcess
Restart the specified process. This kills the process and allows the service to restart it.- Parameters:
process- the process to restart- Since:
- 1
-
setPriority
Set the priority of the specified process.- Parameters:
process- the process to change the priority ofpriority- the new priority -20..19 (unix semantics)- Since:
- 1
-
getProcesses
Return a list of processes that are currently expected to be running on the specified node.- Returns:
- list of processes
- Since:
- 1
-