Permalink
Browse files

add static close methods to main class entry point

  • Loading branch information...
1 parent bfb4666 commit 325064c7aab4eec6a732a3624913b6c0044c4d14 @kimchy kimchy committed Oct 17, 2011
@@ -57,9 +57,10 @@
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 void destroy() {
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)
@@ -24,6 +24,10 @@
*/
public class ElasticSearch extends Bootstrap {
+ public static void close(String[] args) {
+ Bootstrap.close(args);
+ }
+
public static void main(String[] args) {
Bootstrap.main(args);
}

0 comments on commit 325064c

Please sign in to comment.