Move over to using JniLoader.jniEnabled to simplify code.
RELNOTES:
PiperOrigin-RevId: 279092981
diff --git a/src/main/java/com/google/devtools/build/lib/platform/SleepPreventionModule.java b/src/main/java/com/google/devtools/build/lib/platform/SleepPreventionModule.java
index bf2735c..a8ad277 100644
--- a/src/main/java/com/google/devtools/build/lib/platform/SleepPreventionModule.java
+++ b/src/main/java/com/google/devtools/build/lib/platform/SleepPreventionModule.java
@@ -43,22 +43,16 @@
public static native int popDisableSleep();
}
- private final Boolean jniEnabled;
-
- public SleepPreventionModule() {
- this.jniEnabled = !"0".equals(System.getProperty("io.bazel.EnableJni"));
- }
-
@Override
public void beforeCommand(CommandEnvironment env) throws AbruptExitException {
- if (jniEnabled) {
+ if (JniLoader.jniEnabled()) {
SleepPrevention.pushDisableSleep();
}
}
@Override
public void afterCommand() throws AbruptExitException {
- if (jniEnabled) {
+ if (JniLoader.jniEnabled()) {
SleepPrevention.popDisableSleep();
}
}