Skip to content

Commit

Permalink
Fix oshi (#1004)
Browse files Browse the repository at this point in the history
  • Loading branch information
imbyungjun authored Feb 27, 2024
1 parent 2d9ae33 commit 5c702ff
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 9 deletions.
4 changes: 2 additions & 2 deletions ngrinder-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ description = "ngrinder-core"
dependencies {
api (project(":ngrinder-groovy"))
api (group: "org.apache.commons", name: "commons-compress", version: "1.4.1")
api (group: "com.github.oshi", name: "oshi-core", version: "6.1.6")
api (group: "com.github.oshi", name: "oshi-core-java11", version: "6.4.13")

implementation files("${rootDir}/lib/grinder-3.9.1-patch.jar")
implementation (group: "org.pf4j", name: "pf4j", version: "3.0.1")
implementation (group: "javax.servlet", name: "javax.servlet-api", version: "3.1.0")
implementation (group: "commons-collections", name: "commons-collections", version: "3.2.1")
implementation (group: "com.fasterxml.jackson.core", name: "jackson-annotations", version: jackson_version)
implementation (group: "com.fasterxml.jackson.core", name: "jackson-databind", version: jackson_version)
implementation (group: "net.java.dev.jna", name: "jna", version: "5.6.0")
implementation (group: "net.java.dev.jna", name: "jna", version: "5.14.0")
implementation (group: "commons-codec", name: "commons-codec", version: "1.14")
implementation (group: "com.beust", name: "jcommander", version: "1.32")
implementation (group: "ch.qos.logback", name: "logback-classic", version: "1.0.0")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
import static org.ngrinder.common.util.Preconditions.checkNotEmpty;
import static org.ngrinder.common.util.Preconditions.checkNotNull;
import static org.ngrinder.common.util.SystemInfoUtils.getAvailableMemory;
import static org.ngrinder.common.util.SystemInfoUtils.getJDKVersion;

/**
* Class which is responsible to build custom jvm arguments.
Expand Down Expand Up @@ -205,7 +204,7 @@ public String buildJVMArgumentWithoutMemory() {
addAdditionalJavaOpt(jvmArguments);
}

String jdkVersion = getJDKVersion();
String jdkVersion = System.getProperty("java.specification.version");
if (jdkVersion != null && !jdkVersion.startsWith("1.")) {
jvmArguments.append(" --add-opens java.base/java.net=ALL-UNNAMED ");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@

import static com.sun.jna.Platform.isWindows;
import static java.lang.System.currentTimeMillis;
import static java.lang.System.getProperty;
import static oshi.util.ExecutingCommand.runNative;

/**
Expand Down Expand Up @@ -104,10 +103,6 @@ public static BandWidth getNetworkUsage() {
return getBandWidth(rx, tx);
}

public static String getJDKVersion() {
return getProperty("java.specification.version");
}

private static BandWidth getBandWidth(long rx, long tx) {
BandWidth bandWidth = new BandWidth(currentTimeMillis());
bandWidth.setReceived(bandWidth.getReceived() + rx);
Expand Down

0 comments on commit 5c702ff

Please sign in to comment.