add static close methods to main class entry point

This commit is contained in:
Shay Banon 2011-10-17 20:25:41 +02:00
parent bfb4666b3d
commit 325064c7aa
2 changed files with 11 additions and 2 deletions

View File

@ -57,9 +57,10 @@ public class Bootstrap {
private Node node;
private static volatile Thread keepAliveThread;
private static volatile CountDownLatch keepAliveLatch;
private static Bootstrap bootstrap;
private void setup(boolean addShutdownHook, Tuple<Settings, Environment> tuple) throws Exception {
// Loggers.getLogger(Bootstrap.class, tuple.v1().get("name")).info("heap_size {}/{}", JvmStats.jvmStats().mem().heapCommitted(), JvmInfo.jvmInfo().mem().heapMax());
if (tuple.v1().getAsBoolean("bootstrap.mlockall", false)) {
@ -137,10 +138,14 @@ public class Bootstrap {
node.close();
}
public static void close(String[] args) {
bootstrap.destroy();
keepAliveLatch.countDown();
}
public static void main(String[] args) {
System.setProperty("es.logger.prefix", "");
Bootstrap bootstrap = new Bootstrap();
bootstrap = new Bootstrap();
String pidFile = System.getProperty("es-pidfile");
// enable jline by default when running form "main" (and not on windows)

View File

@ -24,6 +24,10 @@ package org.elasticsearch.bootstrap;
*/
public class ElasticSearch extends Bootstrap {
public static void close(String[] args) {
Bootstrap.close(args);
}
public static void main(String[] args) {
Bootstrap.main(args);
}