added command line option to use nbio cache

This commit is contained in:
Mark Wolters
2024-04-09 09:02:08 -04:00
committed by Jonathan Shook
parent 3845fd8256
commit 45ac75b90b
3 changed files with 26 additions and 1 deletions

View File

@@ -220,6 +220,7 @@ public class NBCLI implements Function<String[], Integer>, NBLabeledElement {
NBCLI.logger = LogManager.getLogger("NBCLI");
NBIO.addGlobalIncludes(options.wantsIncludes());
NBIO.setUseNBIOCache(options.wantsToUseNBIOCache());
if (options.wantsBasicHelp()) {
System.out.println(this.loadHelpFile("basic.md"));

View File

@@ -137,6 +137,7 @@ public class NBCLIOptions {
private static final String DEFAULT_CONSOLE_PATTERN = "TERSE";
private static final String DEFAULT_LOGFILE_PATTERN = "VERBOSE";
private final static String ENABLE_DEDICATED_VERIFICATION_LOGGER = "--enable-dedicated-verification-logging";
private final static String USE_NBIO_CACHE = "--use-nbio-cache";
// private static final String DEFAULT_CONSOLE_LOGGING_PATTERN = "%d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n";
@@ -206,6 +207,7 @@ public class NBCLIOptions {
private String metricsLabelSpec = "";
private String wantsToCatResource = "";
private long heartbeatIntervalMs = 10000;
private boolean useNBIOCache = false;
public boolean wantsLoggedMetrics() {
return this.wantsConsoleMetrics;
@@ -651,6 +653,10 @@ public class NBCLIOptions {
this.heartbeatIntervalMs =
Long.parseLong(this.readWordOrThrow(arglist, "heartbeat interval in ms"));
break;
case USE_NBIO_CACHE:
arglist.removeFirst();
this.useNBIOCache = true;
break;
default:
nonincludes.addLast(arglist.removeFirst());
}
@@ -812,6 +818,9 @@ public class NBCLIOptions {
public NBLogLevel getConsoleLogLevel() {
return this.consoleLevel;
}
public boolean wantsToUseNBIOCache() {
return this.useNBIOCache;
}
private String readWordOrThrow(final LinkedList<String> arglist, final String required) {
if (null == arglist.peekFirst())

View File

@@ -43,6 +43,8 @@ public class NBIO implements NBPathsAPI.Facets {
private static String[] globalIncludes = new String[0];
private static boolean useNBIOCache;
public synchronized static void addGlobalIncludes(String[] globalIncludes) {
NBIO.globalIncludes = globalIncludes;
}
@@ -163,7 +165,11 @@ public class NBIO implements NBPathsAPI.Facets {
*/
@Override
public NBPathsAPI.GetPrefixes allContent() {
this.resolver = URIResolvers.inFS().inCP().inURLs().inNBIOCache();
if (useNBIOCache) {
this.resolver = URIResolvers.inFS().inCP().inNBIOCache();
} else {
this.resolver = URIResolvers.inFS().inCP().inURLs();
}
return this;
}
@@ -628,4 +634,13 @@ public class NBIO implements NBPathsAPI.Facets {
", extensionSets=" + extensionSets +
'}';
}
public boolean useNBIOCache() {
return useNBIOCache;
}
public static void setUseNBIOCache(boolean wantsToUseNBIOCache) {
useNBIOCache = wantsToUseNBIOCache;
}
}