Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
import org.elasticsearch.common.logging.Loggers;

import java.io.IOError;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Objects;
import java.util.function.Supplier;

Expand Down Expand Up @@ -85,10 +87,16 @@ void onNonFatalUncaught(final String threadName, final Throwable t) {
}

// visible for testing
@SuppressForbidden(reason = "halt")
void halt(int status) {
// we halt to prevent shutdown hooks from running
Runtime.getRuntime().halt(status);
AccessController.doPrivileged(new PrivilegedAction<Void>() {
@SuppressForbidden(reason = "halt")
@Override
public Void run() {
// we halt to prevent shutdown hooks from running
Runtime.getRuntime().halt(status);
return null;
}
});
}

}