All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wildfly.plugin.server.ProcessDestroyTimer Maven / Gradle / Ivy

/*
 * Copyright The WildFly Authors
 * SPDX-License-Identifier: Apache-2.0
 */

package org.wildfly.plugin.server;

import java.util.concurrent.TimeUnit;

/**
 * @author James R. Perkins
 */
class ProcessDestroyTimer extends Thread {
    private final Process process;
    private final long timeout;

    ProcessDestroyTimer(final Process process, final long timeout) {
        this.process = process;
        this.timeout = timeout;
    }

    static ProcessDestroyTimer start(final Process process, final long timeout) {
        final ProcessDestroyTimer result = new ProcessDestroyTimer(process, timeout);
        result.start();
        return result;
    }

    @Override
    public void run() {
        try {
            TimeUnit.SECONDS.sleep(timeout);
            process.destroy();
        } catch (InterruptedException ignore) {
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy