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

com.yahoo.container.protect.ProcessTerminator Maven / Gradle / Ivy

// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.container.protect;

import com.yahoo.protect.Process;

/**
 * An injectable terminator of the Java vm.
 * Components that encounters conditions where the vm should be terminated should
 * request an instance of this injected. That makes termination testable
 * as tests can create subclasses of this which register the termination request
 * rather than terminating.
 *
 * @author bratseth
 */
public class ProcessTerminator {

    /** Logs and dies without taking a thread dump */
    public void logAndDie(String message) {
        logAndDie(message, false);
    }

    /**
     * Logs and dies
     *
     * @param dumpThreads if true the stack trace of all threads is dumped to the
     *                   log with level info before shutting down
     */
    public void logAndDie(String message, boolean dumpThreads) {
        Process.logAndDie(message, dumpThreads);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy