diff --git a/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java b/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java index 15851b9dc18..84663f60a4d 100644 --- a/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java +++ b/src/main/java/org/elasticsearch/bootstrap/Bootstrap.java @@ -84,14 +84,6 @@ public class Bootstrap { /** initialize native resources */ public static void initializeNatives(boolean mlockAll, boolean ctrlHandler, boolean loadSigar) { final ESLogger logger = Loggers.getLogger(Bootstrap.class); - // mlockall if requested - if (mlockAll) { - if (Constants.WINDOWS) { - Natives.tryVirtualLock(); - } else { - Natives.tryMlockall(); - } - } // check if the user is running as root, and bail if (Natives.definitelyRunningAsRoot()) { @@ -101,6 +93,15 @@ public class Bootstrap { throw new RuntimeException("don't run elasticsearch as root."); } } + + // mlockall if requested + if (mlockAll) { + if (Constants.WINDOWS) { + Natives.tryVirtualLock(); + } else { + Natives.tryMlockall(); + } + } // listener for windows close event if (ctrlHandler) {