Java Code Examples for org.wildfly.swarm.tools.exec.SwarmProcess#stop()

The following examples show how to use org.wildfly.swarm.tools.exec.SwarmProcess#stop() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StopTask.java    From thorntail with Apache License 2.0 6 votes vote down vote up
@TaskAction
public void stopThorntailProcess() {
    ThorntailExtension extension = getProject().getExtensions().getByType(ThorntailExtension.class);

    SwarmProcess process = (SwarmProcess) getProject().findProperty(PackagePlugin.THORNTAIL_PROCESS_PROPERTY);
    if (process == null) {
        getLogger().error("No Thorntail process was found to stop.");
        return;
    }
    try {
        getLogger().info("Stopping Thorntail process.");
        process.stop(extension.getStopTimeout(), TimeUnit.SECONDS);
    } catch (InterruptedException ie) {
        // Do nothing
    } finally {
        process.destroyForcibly();
    }
}
 
Example 2
Source File: StopMojo.java    From wildfly-swarm with Apache License 2.0 5 votes vote down vote up
protected void stop(SwarmProcess process) throws MojoFailureException {
    if (process != null) {
        try {
            process.stop(10, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
            throw new MojoFailureException("unable to stop process", e);
        }
    }
}
 
Example 3
Source File: StartTask.java    From thorntail with Apache License 2.0 5 votes vote down vote up
private void stopProcess(SwarmProcess process) {
    if (process != null && process.isAlive()) {
        try {
            process.stop(extension.getStopTimeout(), TimeUnit.SECONDS);
        } catch (InterruptedException e) {
            // ignore
        } finally {
            process.destroyForcibly();
        }
    }
}
 
Example 4
Source File: StopMojo.java    From thorntail with Apache License 2.0 5 votes vote down vote up
protected void stop(SwarmProcess process) throws MojoFailureException {
    if (process != null) {
        try {
            process.stop(10, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
            throw new MojoFailureException("unable to stop process", e);
        }
    }
}
 
Example 5
Source File: StopMojo.java    From ARCHIVE-wildfly-swarm with Apache License 2.0 5 votes vote down vote up
protected void stop(SwarmProcess process) throws MojoFailureException {
    if (process != null) {
        try {
            process.stop(10, TimeUnit.SECONDS);
        } catch (InterruptedException e) {
            throw new MojoFailureException("unable to stop process", e);
        }
    }
}