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

org.bitbucket.bradleysmithllc.java_cl_parser.ShutdownHandler Maven / Gradle / Ivy

Go to download

This parser strives to achieve an elegant, ioc-type interface to make launching command-line projects effortless.

There is a newer version: 3.4.2
Show newest version
package org.bitbucket.bradleysmithllc.java_cl_parser;

public class ShutdownHandler {
	private static ShutdownHandler instance = new ShutdownHandler();
	private static ShutdownHandler runInstance = new ShutdownHandler();

	public static ShutdownHandler instance() {
		return runInstance != null ? runInstance : instance;
	}

	public synchronized Object shutdown(int code) {
		// default implementation
		System.exit(code);
		return null;
	}

	public static void resetInstance()
	{
		runInstance = null;
	}

	public static void setInstance(ShutdownHandler newInstance) {
		// (probably also check that this is only called in a test environment)
		runInstance = newInstance;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy