Class ServerProcess

java.lang.Object
org.wildfly.qa.tooling.processexecution.ServerProcess
Direct Known Subclasses:
BootableJarProcess, DomainServerProcess

public class ServerProcess extends Object
Abstraction over server process - starting the process, executing a runnable in the right moment and destroying it.
  • Constructor Details

    • ServerProcess

      public ServerProcess(org.apache.commons.exec.CommandLine startScript)
      Create a new instance of server process. Instantiating won't create the server process. Timeout is read from system property ProcessExecutionProperties.SERVER_PROCESS_TIMEOUT_MINUTES (default 5 minutes). If you wish to have other timeout use ServerProcess(CommandLine, long, TimeUnit).
      Parameters:
      startScript - start script command line
    • ServerProcess

      public ServerProcess(org.apache.commons.exec.CommandLine startScript, long timeout, TimeUnit timeUnit)
      Create a new instance of server process. Instantiating won't create the server process.
      Parameters:
      startScript - start script command line
      timeout - the maximum time to wait
      timeUnit - the time unit of the timeout parameter
    • ServerProcess

      protected ServerProcess(org.apache.commons.exec.CommandLine startScript, long timeout, TimeUnit timeUnit, org.wildfly.extras.creaper.core.online.OnlineOptions onlineOptions)
      Create a new instance of server process. Instantiating won't create the server process.
      Parameters:
      startScript - start script command line
      timeout - the maximum time to wait
      timeUnit - the time unit of the timeout parameter
      onlineOptions - options for server settings
  • Method Details

    • runAfterServerStartedAndDestroyProcess

      public void runAfterServerStartedAndDestroyProcess(ServerProcess.ServerRunnable runnable) throws IOException, InterruptedException
      Start a server and run a runnable after the server started. Completed start is detected by "started in" line in the server log. e.g. 12:03:45,777 INFO [org.jboss.as] (Controller Boot Thread) WFLYSRV0025: WildFly 41.0.1.Final (WildFly Core 23.0.3.Final) started in 2315ms - Started 317 of 556 services (343 services are lazy, passive or on-demand) Please be aware that the timeout is set in constructor
      Parameters:
      runnable - a runnable which should be run when server started. Server will be destroyed after runnable completed.
      Throws:
      IOException
      InterruptedException
    • runAfterDeploymentCompletedAndDestroyProcess

      public void runAfterDeploymentCompletedAndDestroyProcess(String deploymentName, ServerProcess.ServerRunnable runnable) throws IOException, InterruptedException
      Start a server and run a runnable after the deployment was deployed. Completed deployment is detected by 'Deployed "<name>"' in the log. e.g. 12:07:31,023 INFO [org.jboss.as.server] (management-handler-thread - 1) WFLYSRV0010: Deployed "fooqixbar" (runtime-name : "qux") Please be aware that the timeout is set in constructor
      Parameters:
      deploymentName - name of deployment which wil trigger runnable run.
      runnable - a runnable which should be run when server started. Server will be destroyed after runnable completed.
      Throws:
      IOException
      InterruptedException
    • runWhenClientConnectsAndDestroyProcess

      public void runWhenClientConnectsAndDestroyProcess(ServerProcess.ServerRunnable runnable) throws IOException, InterruptedException
      Start a server and run a runnable after the deployment was deployed and client connected.
      Parameters:
      runnable - a runnable which should be run when server started. Server will be destroyed after runnable completed.
      Throws:
      IOException
      InterruptedException