Class SlaveNodeLauncher

java.lang.Object
org.jppf.utils.concurrent.ThreadSynchronization
org.jppf.process.AbstractProcessLauncher
org.jppf.node.provisioning.SlaveNodeLauncher
All Implemented Interfaces:
Runnable

public class SlaveNodeLauncher extends org.jppf.process.AbstractProcessLauncher
This class wraps a single slave node process and provides an API to start, stop and monitor it.
Since:
4.1
Author:
Laurent Cohen
  • Nested Class Summary

    Nested classes/interfaces inherited from class org.jppf.process.AbstractProcessLauncher

    org.jppf.process.AbstractProcessLauncher.SlaveSocketWrapper
  • Field Summary

    Fields inherited from class org.jppf.process.AbstractProcessLauncher

    end, listeners, name, process, processPort, processServer, slaveSocketWrapper

    Fields inherited from class org.jppf.utils.concurrent.ThreadSynchronization

    stopped
  • Constructor Summary

    Constructors
    Constructor
    Description
    SlaveNodeLauncher(int id, String name, List<String> classpath)
    Initialize this process launcher.
    SlaveNodeLauncher(int id, String name, List<String> classpath, long startDelay)
    Initialize this process launcher.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Get the id given to this process.
     
    boolean
    Determine whether the slave node is started.
    boolean
    Determine whether the slave node is stopped.
    protected boolean
    Called when the subprocess has exited with exit value n.
    void
    run()
    Start the subprocess.
    void
    setStarted(boolean started)
    Specify whether the slave node is started.
    void
    setStopped(boolean stopped)
    Specify whether the slave node is stopped.

    Methods inherited from class org.jppf.process.AbstractProcessLauncher

    addProcessLauncherListener, buildClasspath, computeJavaExecPath, createShutdownHook, fireProcessStarted, fireProcessStopped, getName, getProcess, parseJvmOptions, removeProcessLauncherListener, sendActionCommand, startSocketListener, tearDown

    Methods inherited from class org.jppf.utils.concurrent.ThreadSynchronization

    goToSleep, goToSleep, goToSleep, wakeUp

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • SlaveNodeLauncher

      public SlaveNodeLauncher(int id, String name, List<String> classpath)
      Initialize this process launcher.
      Parameters:
      id - the id as an int.
      name - internal name given tot he process.
      classpath - the slave node's classpath.
    • SlaveNodeLauncher

      public SlaveNodeLauncher(int id, String name, List<String> classpath, long startDelay)
      Initialize this process launcher.
      Parameters:
      id - the id as an int.
      name - internal name given tot he process.
      classpath - the slave node's classpath.
      startDelay - how log to wait before actually starting the slave process.
  • Method Details

    • run

      public void run()
      Start the subprocess. If exit code is 2, then the subprocess is restarted.
    • onProcessExit

      protected boolean onProcessExit(int n)
      Called when the subprocess has exited with exit value n. This allows for printing the residual output (both standard and error) to this pJVM's console and log file, in order to get additional information if a problem occurred.
      Specified by:
      onProcessExit in class org.jppf.process.AbstractProcessLauncher
      Parameters:
      n - the exit value of the subprocess.
      Returns:
      true if this launcher is to be terminated, false if it should re-launch the subprocess.
    • getId

      public int getId()
      Get the id given to this process.
      Returns:
      the id as an int.
    • isStarted

      public boolean isStarted()
      Determine whether the slave node is started.
      Returns:
      true if the slave is started, false otherwise.
    • setStarted

      public void setStarted(boolean started)
      Specify whether the slave node is started.
      Parameters:
      started - true if the slave is started, false otherwise.
    • isStopped

      public boolean isStopped()
      Determine whether the slave node is stopped.
      Overrides:
      isStopped in class org.jppf.utils.concurrent.ThreadSynchronization
      Returns:
      true if the slave is stopped, false otherwise.
    • setStopped

      public void setStopped(boolean stopped)
      Specify whether the slave node is stopped.
      Overrides:
      setStopped in class org.jppf.utils.concurrent.ThreadSynchronization
      Parameters:
      stopped - true if the slave is stopped, false otherwise.
    • getLaunchCommand

      public List<String> getLaunchCommand()
      Returns:
      the command line used to start the slave node process.