Class StandaloneManager

    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected ProcessHandle process  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      org.jboss.as.controller.client.ModelControllerClient client()
      Returns the client associated with this server manager.
      void close()
      ContainerDescription containerDescription()
      Returns the container description for the running server.
      DeploymentManager deploymentManager()
      Returns the deployment manager for the server.
      void executeReload()
      Reloads the server and returns immediately.
      void executeReload​(org.jboss.dmr.ModelNode reloadOp)
      Reloads the server and returns immediately.
      boolean isClosed()
      Checks if this server manager has been closed.
      boolean isRunning()
      Checks to see if a server is running.
      CompletableFuture<ServerManager> kill()
      If a process is available and alive, the process is attempted to be killed.
      String launchType()
      Determines the servers "launch-type".
      void reloadIfRequired()
      Checks if the container status is "reload-required" and if it's the case, executes reload and waits for completion with a 10 second timeout.
      void reloadIfRequired​(long timeout, TimeUnit unit)
      Checks if the container status is "reload-required" and if it's the case, executes reload and waits for completion.
      String serverState()
      Gets the "server-state" for standalone servers or the "host-state" for domain servers.
      void shutdown​(long timeout)
      Shuts down the server and wait for the servers to be shutdown.
      CompletableFuture<ServerManager> shutdownAsync​(long timeout)
      Shuts down the server.
      String takeSnapshot()
      Takes a snapshot of the current servers configuration and returns the relative file name of the snapshot.
      boolean waitFor​(long startupTimeout, TimeUnit unit)
      Waits the given amount of time for a server to start.
    • Method Detail

      • serverState

        public String serverState()
        Description copied from interface: ServerManager
        Gets the "server-state" for standalone servers or the "host-state" for domain servers.
        Returns:
        the server-state or "failed" if an error occurred
      • executeReload

        public void executeReload()
                           throws IOException
        Description copied from interface: ServerManager
        Reloads the server and returns immediately.
        Throws:
        IOException - if an error occurs communicating with the server
      • reloadIfRequired

        public void reloadIfRequired​(long timeout,
                                     TimeUnit unit)
                              throws IOException
        Description copied from interface: ServerManager
        Checks if the container status is "reload-required" and if it's the case, executes reload and waits for completion.
        Parameters:
        timeout - the time to wait for the server to reload
        unit - the time unit for the timeout argument
        Throws:
        IOException - if an error occurs communicating with the server
      • isRunning

        public boolean isRunning()
        Description copied from interface: ServerManager
        Checks to see if a server is running.
        Returns:
        true if the server is running, otherwise false
      • client

        public org.jboss.as.controller.client.ModelControllerClient client()
        Description copied from interface: ServerManager
        Returns the client associated with this server manager.
        Specified by:
        client in interface ServerManager
        Returns:
        a client to communicate with the server
      • launchType

        public String launchType()
        Determines the servers "launch-type".
        Specified by:
        launchType in interface ServerManager
        Returns:
        the servers launch-type or "unknown" if it could not be determined
      • waitFor

        public boolean waitFor​(long startupTimeout,
                               TimeUnit unit)
                        throws InterruptedException
        Description copied from interface: ServerManager
        Waits the given amount of time for a server to start.

        If the process is not null and a timeout occurs the process will be destroyed.

        Specified by:
        waitFor in interface ServerManager
        Parameters:
        startupTimeout - the time, to wait for the server start
        unit - the time unit for the startupTimeout argument
        Returns:
        true if the server is up and running, false if a timeout occurred waiting for the server to be in a running state
        Throws:
        InterruptedException - if interrupted while waiting for the server to start
      • shutdown

        public void shutdown​(long timeout)
                      throws IOException
        Description copied from interface: ServerManager
        Shuts down the server and wait for the servers to be shutdown.
        Specified by:
        shutdown in interface ServerManager
        Parameters:
        timeout - the graceful shutdown timeout, a value of -1 will wait indefinitely and a value of 0 will not attempt a graceful shutdown
        Throws:
        IOException - if an error occurs communicating with the server
      • shutdownAsync

        public CompletableFuture<ServerManager> shutdownAsync​(long timeout)
        Description copied from interface: ServerManager
        Shuts down the server.

        The returned ServerManager is the same instance of this server manager. You can use the CompletableFuture.get() to wait until the process, if available, to exit.

        Note for implementations. The default method should likely not be used. Care must be taken to ensure a TimeoutException on a CompletableFuture.get() stops the shutdown from continuing to run in the background.

        Specified by:
        shutdownAsync in interface ServerManager
        Parameters:
        timeout - the graceful shutdown timeout, a value of -1 will wait indefinitely and a value of 0 will not attempt a graceful shutdown
        Returns:
        a completable future that on a CompletableFuture.get() will wait for the process, if available, exits
      • isClosed

        public boolean isClosed()
        Description copied from interface: ServerManager
        Checks if this server manager has been closed. The server manager may be closed if the underlying client was closed.
        Specified by:
        isClosed in interface ServerManager
        Returns:
        true if the server manager was closed, otherwise false