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

org.metricssampler.daemon.commands.ShutdownCommand Maven / Gradle / Ivy

The newest version!
package org.metricssampler.daemon.commands;

import org.metricssampler.service.Bootstrapper;

import java.io.BufferedReader;
import java.io.BufferedWriter;

import static org.apache.commons.io.IOUtils.closeQuietly;

public class ShutdownCommand extends BaseControlCommand {
	private final Bootstrapper bootstrapper;

	protected ShutdownCommand(final BufferedReader reader, final BufferedWriter writer, final Bootstrapper bootstrapper) {
		super(reader, writer);
		this.bootstrapper = bootstrapper;
	}

	@Override
	public void execute() {
		logger.info("Shutdown command received");
		logger.info("Shutting down thread pools");
		bootstrapper.shutdown();
		closeQuietly(writer);
		System.exit(0);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy