Do the root check first, so resource limits arent confusing if you are root.
This commit is contained in:
parent
74bb715689
commit
1e5e36d48d
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue