mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -06:00
modify logger calls for computable messages via closures
This commit is contained in:
parent
a06cf565ee
commit
6731937c96
@ -110,7 +110,7 @@ public abstract class Cqld4BaseOpDispenser extends BaseOpDispenser<Cqld4CqlOp, C
|
||||
|
||||
private Statement showstmt(Statement stmt, boolean input) {
|
||||
String query = cqlFor(stmt, new StringBuilder());
|
||||
logger.info("CQL(SIMPLE): " + query);
|
||||
logger.info(() -> "CQL(SIMPLE): " + query);
|
||||
return stmt;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class Cqld4CoreOpMapper implements OpMapper<Op> {
|
||||
|
||||
TypeAndTarget<CqlD4OpType, String> target = op.getTypeAndTarget(CqlD4OpType.class, String.class, "type", "stmt");
|
||||
|
||||
logger.info("Using " + target.enumId + " statement form for '" + op.getName());
|
||||
logger.info(() -> "Using " + target.enumId + " statement form for '" + op.getName());
|
||||
|
||||
return switch (target.enumId) {
|
||||
case raw -> new CqlD4RawStmtMapper(adapter, sessionFunc, target.targetFunction).apply(op);
|
||||
|
@ -103,7 +103,7 @@ public class Cqld4FluentGraphOpMapper implements OpMapper<Op> {
|
||||
try {
|
||||
loader.loadClass(candidateName);
|
||||
classNames.add(candidateName);
|
||||
logger.debug("added import " + candidateName);
|
||||
logger.debug(() -> "added import " + candidateName);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Class '" + candidateName + "' was not found for fluent imports.");
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ public class RingAnalyzer implements BundledApp {
|
||||
CommandLine cli = new CommandLine(cfg);
|
||||
CommandLine.ParseResult cl = cli.parseArgs(args);
|
||||
|
||||
logger.info("filename: " + cfg.filename);
|
||||
logger.info(() -> "filename: " + cfg.filename);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
@ -117,7 +117,7 @@ public class BindingsAccumulator {
|
||||
accumulated.forEach((k,v) -> {
|
||||
inverted.computeIfAbsent(v,def -> new HashSet<>()).add(k);
|
||||
});
|
||||
logger.info("computed " + accumulated.size() + " raw bindings, consisting of " + inverted.size() + " unique definitions.");
|
||||
logger.info(() -> "computed " + accumulated.size() + " raw bindings, consisting of " + inverted.size() + " unique definitions.");
|
||||
return accumulated;
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public class CGTextTransformers implements Consumer<List<Map<String, ?>>>, Suppl
|
||||
Object cfgvalues = cfgmap.get("config");
|
||||
if (cfgvalues != null) {
|
||||
configurable.accept((cfgvalues));
|
||||
logger.info("configured transformer with " + cfgvalues);
|
||||
logger.info(() -> "configured transformer with " + cfgvalues);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,7 +92,7 @@ public class CGWorkloadExporter implements BundledApp {
|
||||
@Override
|
||||
public int applyAsInt(String[] args) {
|
||||
|
||||
logger.info("running CQL workload exporter with args:" + Arrays.toString(args));
|
||||
logger.info(() -> "running CQL workload exporter with args:" + Arrays.toString(args));
|
||||
|
||||
if (args.length == 0) {
|
||||
throw new RuntimeException("Usage example: PROG filepath.cql filepath.yaml");
|
||||
@ -195,7 +195,7 @@ public class CGWorkloadExporter implements BundledApp {
|
||||
private String loadFile(Path path) {
|
||||
try {
|
||||
String ddl = Files.readString(path);
|
||||
logger.info("read " + ddl.length() + " character DDL file");
|
||||
logger.info(() -> "read " + ddl.length() + " character DDL file");
|
||||
return ddl;
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
@ -348,7 +348,7 @@ public class CGWorkloadExporter implements BundledApp {
|
||||
blockdata.put("ops", ops);
|
||||
for (CqlTable table : model.getTableDefs()) {
|
||||
if (table.getClusteringColumns().size() == 0) {
|
||||
logger.debug("skipping table " + table.getFullName() + " for scan since there are no clustering columns");
|
||||
logger.debug(() -> "skipping table " + table.getFullName() + " for scan since there are no clustering columns");
|
||||
}
|
||||
ops.put(
|
||||
namer.nameFor(table, "optype", "scan", "blockname", blockname),
|
||||
|
@ -75,18 +75,18 @@ public class CqlModel {
|
||||
|
||||
CqlKeyspaceDef ksdef = getKeyspace(statsKeyspacename);
|
||||
if (ksdef !=null) {
|
||||
logger.debug("setting keyspace stats for '" + statsKeyspacename + "'");
|
||||
logger.debug(() -> "setting keyspace stats for '" + statsKeyspacename + "'");
|
||||
ksdef.setStats(keyspaceStats);
|
||||
keyspaceStats.getKeyspaceTables().forEach((tbname, tbstats) -> {
|
||||
CqlTable table = ksdef.getTable(tbname);
|
||||
if (table != null) {
|
||||
table.setStats(tbstats);
|
||||
} else {
|
||||
logger.debug(" skipping table '" + statsKeyspacename + "." + tbname + ", since it was not found in the model.");
|
||||
logger.debug(() -> " skipping table '" + statsKeyspacename + "." + tbname + ", since it was not found in the model.");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
logger.debug(" skipping keyspace stats for '" + statsKeyspacename + "'");
|
||||
logger.debug(() -> " skipping keyspace stats for '" + statsKeyspacename + "'");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ public class CqlModelBuilder extends CqlParserBaseListener {
|
||||
@Override
|
||||
public void exitEveryRule(ParserRuleContext ctx) {
|
||||
if ((counted++ & 0b11111111111111) == 0b10000000000000) {
|
||||
logger.trace("parsed " + counted + " elements...");
|
||||
logger.trace(() -> "parsed " + counted + " elements...");
|
||||
}
|
||||
}
|
||||
|
||||
@ -59,7 +59,7 @@ public class CqlModelBuilder extends CqlParserBaseListener {
|
||||
ParseTree parent = node.getParent();
|
||||
String errorNodeType = parent.getClass().getSimpleName();
|
||||
|
||||
logger.info("PARSE ERROR: " + errorNodeType + "\n" + node.getSourceInterval());
|
||||
logger.info(() -> "PARSE ERROR: " + errorNodeType + "\n" + node.getSourceInterval());
|
||||
|
||||
super.visitErrorNode(node);
|
||||
}
|
||||
|
@ -42,9 +42,9 @@ public class CqlModelParser {
|
||||
public static CqlModel parse(Path path) {
|
||||
try {
|
||||
String ddl = Files.readString(path);
|
||||
logger.info("read " + ddl.length() + " character DDL file, parsing");
|
||||
logger.info(() -> "read " + ddl.length() + " character DDL file, parsing");
|
||||
CqlModel parsed = parse(ddl, null);
|
||||
logger.info("parsed cql model: " + parsed.getSummaryLine());
|
||||
logger.info(() -> "parsed cql model: " + parsed.getSummaryLine());
|
||||
return parsed;
|
||||
|
||||
} catch (IOException e) {
|
||||
@ -85,7 +85,7 @@ public class CqlModelParser {
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.warn("Error while parsing flow:" + e.getMessage());
|
||||
logger.warn(() -> "Error while parsing flow:" + e.getMessage());
|
||||
throw e;
|
||||
// return new ParseResult(e);
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class CGGenStatsInjector implements CGModelTransformer, CGTransformerConf
|
||||
String histogramPath = config.get("path").toString();
|
||||
if (histogramPath != null) {
|
||||
if (!Files.exists(Path.of(histogramPath))) {
|
||||
logger.info("No tablestats file was found. at '" + histogramPath + "'.");
|
||||
logger.info(() -> "No tablestats file was found. at '" + histogramPath + "'.");
|
||||
Object onmissing = config.get("onmissing");
|
||||
if (onmissing==null || !String.valueOf(onmissing).toLowerCase(Locale.ROOT).equals("skip")) {
|
||||
logger.error("Unable to load tablestats file from '" + histogramPath + "' because it doesn't exists, and onmissing!=skip.");
|
||||
|
@ -61,10 +61,10 @@ public class CGKeyspaceFilter implements CGModelTransformer, CGTransformerConfig
|
||||
action = pattern.apply(keyspace);
|
||||
switch (action) {
|
||||
case add:
|
||||
logger.debug("including all definitions in " + keyspace + " with inclusion pattern " + pattern);
|
||||
logger.debug(() -> "including all definitions in " + keyspace + " with inclusion pattern " + pattern);
|
||||
break;
|
||||
case remove:
|
||||
logger.info("removing all definitions in " + keyspace + " with exclusion pattern " + pattern);
|
||||
logger.info(() -> "removing all definitions in " + keyspace + " with exclusion pattern " + pattern);
|
||||
model.removeKeyspaceDef(keyspace);
|
||||
case inderminate:
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ public class CGModelTransformers implements
|
||||
Object cfgvalues = cfgmap.get("config");
|
||||
if (cfgvalues !=null ) {
|
||||
configurable.accept((cfgvalues));
|
||||
logger.info("configured transformer with " + cfgvalues);
|
||||
logger.info(() -> "configured transformer with " + cfgvalues);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,7 +108,7 @@ public class CGRegexReplacer implements CGTextTransformer, CGTransformerConfigur
|
||||
while (matcher.find()) {
|
||||
matcher.appendReplacement(sb, replacement);
|
||||
// if (matcher.end() - matcher.start() > 10000) {
|
||||
// logger.info("whoops");
|
||||
// logger.info(()-> "whoops");
|
||||
// }
|
||||
// logger.info("matcher:[" + matcher.group(0) + "][" + matcher.group(1) + "][" + matcher.group(2) + "][" + matcher.group(3));
|
||||
// logger.info(String.format("\tat %2.2f%%", (float) ((float) matcher.start() / (float) s.length())));
|
||||
|
@ -52,7 +52,7 @@ public class CGUdtReplacer implements CGModelTransformer {
|
||||
String[] words = typedef.split("\\W+");
|
||||
for (String word : words) {
|
||||
if (word.toLowerCase(Locale.ROOT).equals(searchFor.toLowerCase(Locale.ROOT))) {
|
||||
logger.info("replacing '" + typedef + "' with blob");
|
||||
logger.info(() -> "replacing '" + typedef + "' with blob");
|
||||
coldef.setTypeDef("blob");
|
||||
break;
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public class UnusedTableRemover implements CGModelTransformer, CGTransformerConf
|
||||
String weightedOpsSpec = table.getTableAttributes().getAttribute("weighted_ops");
|
||||
double weightedOps = Double.parseDouble(weightedOpsSpec);
|
||||
if (weightedOps < minimumThreshold) {
|
||||
logger.info(String.format(
|
||||
logger.info(() -> String.format(
|
||||
"removing table " + table.getKeyspace().getName() + "." + table.getName() + " with minimum weighted_ops of %1.5f under %1.5f",
|
||||
weightedOps, minimumThreshold)
|
||||
);
|
||||
|
@ -72,7 +72,7 @@ public class NameCache {
|
||||
if (this.path.equals(path)) {
|
||||
logger.debug("mapfile unchanged '" + path + "'");
|
||||
} else {
|
||||
logger.info("mapfile changed from '" + this.path + "' to '" + path + "'");
|
||||
logger.info(() -> "mapfile changed from '" + this.path + "' to '" + path + "'");
|
||||
this.path = path;
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class SequenceBlocker {
|
||||
try {
|
||||
task.run();
|
||||
} catch (Exception e) {
|
||||
logger.error("Runnable errored in SequenceBlocker: " + e.getMessage());
|
||||
logger.error(() -> "Runnable errored in SequenceBlocker: " + e.getMessage());
|
||||
if (errorsAreFatal) {
|
||||
this.fatalError = e;
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ public class DiagSpace implements ActivityDefObserver, AutoCloseable {
|
||||
this.cfg = cfg;
|
||||
this.name = name;
|
||||
applyConfig(cfg);
|
||||
logger.trace("diag space initialized as '" + name + "'");
|
||||
logger.trace(() -> "diag space initialized as '" + name + "'");
|
||||
}
|
||||
|
||||
public void applyConfig(NBConfiguration cfg) {
|
||||
@ -68,7 +68,7 @@ public class DiagSpace implements ActivityDefObserver, AutoCloseable {
|
||||
|
||||
@Override
|
||||
public void close() throws Exception {
|
||||
logger.debug("closing diag space '" + this.name + "'");
|
||||
logger.debug(() -> "closing diag space '" + this.name + "'");
|
||||
if (errorOnClose) {
|
||||
throw new RuntimeException("diag space was configured to throw this error when it was configured.");
|
||||
}
|
||||
|
@ -16,21 +16,22 @@
|
||||
|
||||
package io.nosqlbench.activitytype.diag;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
import java.io.PrintStream;
|
||||
|
||||
public class SequenceBlockerTest {
|
||||
private final static Logger logger = LogManager.getLogger(SequenceBlockerTest.class);
|
||||
|
||||
@Test
|
||||
public void await() throws Exception {
|
||||
|
||||
SequenceBlocker sb = new SequenceBlocker(234L, true);
|
||||
new Thread(() -> sb.awaitAndRun(249L,253L, new Printer(System.out, "249-253"))).start();
|
||||
new Thread(() -> sb.awaitAndRun(249L,253L, new Printer(logger, "249-253"))).start();
|
||||
Thread.sleep(100);
|
||||
new Thread(() -> sb.awaitAndRun(247L,249L, new Printer(System.out, "247-249"))).start();
|
||||
new Thread(() -> sb.awaitAndRun(247L,249L, new Printer(logger, "247-249"))).start();
|
||||
Thread.sleep(100);
|
||||
new Thread(() -> sb.awaitAndRun(234L,247L, new Printer(System.out, "234-247"))).start();
|
||||
new Thread(() -> sb.awaitAndRun(234L,247L, new Printer(logger, "234-247"))).start();
|
||||
|
||||
sb.awaitCompletion();
|
||||
System.out.flush();
|
||||
@ -38,17 +39,17 @@ public class SequenceBlockerTest {
|
||||
|
||||
private final static class Printer implements Runnable {
|
||||
|
||||
private final PrintStream printStream;
|
||||
private final Logger logger;
|
||||
private final String out;
|
||||
|
||||
public Printer(PrintStream printStream, String out) {
|
||||
this.printStream = printStream;
|
||||
public Printer(Logger logger, String out) {
|
||||
this.logger = logger;
|
||||
this.out = out;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
printStream.println(out);
|
||||
logger.debug(out);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ public class HttpSpace implements NBNamedElement {
|
||||
|
||||
private HttpClient newClient() {
|
||||
HttpClient.Builder builder = HttpClient.newBuilder();
|
||||
logger.debug("follow_redirects=>" + followRedirects);
|
||||
logger.debug(() -> "follow_redirects=>" + followRedirects);
|
||||
builder = builder.followRedirects(this.followRedirects);
|
||||
builder = builder.connectTimeout(this.timeout);
|
||||
return builder.build();
|
||||
|
@ -35,7 +35,7 @@ public class HttpStatusCodesTest {
|
||||
assertThat(result.getReference()).isEqualTo("[RFC7231, Section 6.5.4]");
|
||||
assertThat(result.getValues()).isEqualTo("404");
|
||||
assertThat(result.getDescription()).isEqualTo("Not Found");
|
||||
logger.debug(result.toString(404));
|
||||
logger.debug(() -> result.toString(404));
|
||||
assertThat(result.toString(404)).isEqualTo("404, Not Found, [https://www.iana.org/go/rfc7231#section-6.5.4], CLIENT_ERROR (The request contains bad syntax or cannot be fulfilled.)");
|
||||
}
|
||||
|
||||
@ -46,7 +46,7 @@ public class HttpStatusCodesTest {
|
||||
assertThat(result.getReference()).isEqualTo("[check https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml]");
|
||||
assertThat(result.getValues()).isEqualTo("496");
|
||||
assertThat(result.getDescription()).isNullOrEmpty();
|
||||
logger.debug(result.toString(496));
|
||||
logger.debug(() -> result.toString(496));
|
||||
assertThat(result.toString(496)).isEqualTo("496, [check https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml], CLIENT_ERROR (The request contains bad syntax or cannot be fulfilled.)");
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ public class HttpStatusCodesTest {
|
||||
assertThat(result.getReference()).isEqualTo("[check https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml]");
|
||||
assertThat(result.getValues()).isEqualTo("747");
|
||||
assertThat(result.getDescription()).isNullOrEmpty();
|
||||
logger.debug(result.toString(747));
|
||||
logger.debug(() -> result.toString(747));
|
||||
assertThat(result.toString(747)).isEqualTo("747, [check https://www.iana.org/assignments/http-status-codes/http-status-codes.xhtml], UNKNOWN_ERROR (This error type is not known based on IANA registered HTTP status codes.)");
|
||||
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class MongoOpMapper implements OpMapper<Op> {
|
||||
LongFunction<MongoSpace> spaceF = l -> adapter.getSpaceCache().get(ctxNamer.apply(l));
|
||||
Optional<LongFunction<String>> oDatabaseF = op.getAsOptionalFunction("database");
|
||||
if (oDatabaseF.isEmpty()) {
|
||||
logger.warn(() -> "op field 'database' was not defined");
|
||||
logger.warn("op field 'database' was not defined");
|
||||
}
|
||||
|
||||
Optional<TypeAndTarget<MongoDBOpTypes, String>> target = op.getOptionalTypeAndTargetEnum(MongoDBOpTypes.class, String.class);
|
||||
|
@ -291,8 +291,7 @@ public class S4JSpace implements AutoCloseable {
|
||||
}
|
||||
|
||||
if (logger.isTraceEnabled()) {
|
||||
logger.trace(
|
||||
buildExecSummaryString(trackingMsgCnt, timeElapsedMills, totalResponseCnt, totalNullMsgCnt));
|
||||
logger.trace(buildExecSummaryString(trackingMsgCnt, timeElapsedMills, totalResponseCnt, totalNullMsgCnt));
|
||||
}
|
||||
} while (continueChk);
|
||||
|
||||
|
@ -70,10 +70,10 @@ public class StdoutDriverAdapter extends BaseDriverAdapter<StdoutOp, StdoutSpace
|
||||
.stream()
|
||||
.filter(n -> {
|
||||
if (bindingsFilter.matcher(n).matches()) {
|
||||
logger.trace("bindings filter kept binding '" + n + "'");
|
||||
logger.trace(() -> "bindings filter kept binding '" + n + "'");
|
||||
return true;
|
||||
} else {
|
||||
logger.trace("bindings filter removed binding '" + n + "'");
|
||||
logger.trace(() -> "bindings filter removed binding '" + n + "'");
|
||||
return false;
|
||||
}
|
||||
})
|
||||
|
@ -54,7 +54,7 @@ public class TcpAdapterSpace {
|
||||
|
||||
try {
|
||||
Socket socket = socketFactory.createSocket(host, port);
|
||||
logger.info("connected to " + socket.toString());
|
||||
logger.info(() -> "connected to " + socket.toString());
|
||||
return new PrintWriter(socket.getOutputStream());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Error opening socket:" + e, e);
|
||||
@ -110,7 +110,7 @@ public class TcpAdapterSpace {
|
||||
// InetAddress hostAddr = InetAddress.getByName(host);
|
||||
// listenerSocket = socketFactory.createServerSocket(port, 10, hostAddr);
|
||||
// if (socketFactory instanceof SSLServerSocketFactory) {
|
||||
// logger.info("SSL enabled on server socket " + listenerSocket);
|
||||
// logger.info(() -> "SSL enabled on server socket " + listenerSocket);
|
||||
// }
|
||||
// TCPServerActivity.SocketAcceptor socketAcceptor = new TCPServerActivity.SocketAcceptor(queue, listenerSocket);
|
||||
// managedShutdown.add(socketAcceptor);
|
||||
@ -124,7 +124,7 @@ public class TcpAdapterSpace {
|
||||
// }
|
||||
//
|
||||
// TCPServerActivity.QueueWriterAdapter queueWriterAdapter = new TCPServerActivity.QueueWriterAdapter(this.queue);
|
||||
// logger.info("initialized queue writer:" + queueWriterAdapter);
|
||||
// logger.info(() -> "initialized queue writer:" + queueWriterAdapter);
|
||||
// return queueWriterAdapter;
|
||||
//
|
||||
// }
|
||||
@ -227,7 +227,7 @@ public class TcpAdapterSpace {
|
||||
// writerThread.setName("SocketWriter/" + connectedSocket);
|
||||
// writerThread.setDaemon(true);
|
||||
// writerThread.start();
|
||||
// logger.info("Started writer thread for " + connectedSocket);
|
||||
// logger.info(() -> "Started writer thread for " + connectedSocket);
|
||||
// } catch (SocketTimeoutException ignored) {
|
||||
// }
|
||||
// }
|
||||
|
@ -46,10 +46,11 @@ public class RawStmtsLoader {
|
||||
Collections.addAll(this.transformers, newTransformer);
|
||||
}
|
||||
|
||||
public RawStmtsDocList loadString(Logger logger, String data) {
|
||||
public RawStmtsDocList loadString(Logger logger, final String originalData) {
|
||||
String data = originalData;
|
||||
|
||||
try {
|
||||
if (logger != null) logger.trace("Applying string transformer to yaml data:" + data);
|
||||
if (logger != null) logger.trace(() -> "Applying string transformer to yaml data:" + originalData);
|
||||
for (Function<String, String> transformer : transformers) {
|
||||
data = transformer.apply(data);
|
||||
}
|
||||
@ -103,7 +104,7 @@ public class RawStmtsLoader {
|
||||
protected String applyTransforms(Logger logger, String data) {
|
||||
for (Function<String, String> xform : stringTransformers) {
|
||||
try {
|
||||
if (logger != null) logger.trace("Applying string transformer to yaml data:" + xform);
|
||||
if (logger != null) logger.trace(() -> "Applying string transformer to yaml data:" + xform);
|
||||
data = xform.apply(data);
|
||||
} catch (Exception e) {
|
||||
RuntimeException t = new OpConfigError("Error applying string transforms to input", e);
|
||||
|
@ -42,10 +42,10 @@ public class RawYamlLoader {
|
||||
addTransformer(new StrInterpolator());
|
||||
}
|
||||
|
||||
public List<Map<String,Object>> loadString(Logger logger, String data) {
|
||||
|
||||
public List<Map<String,Object>> loadString(Logger logger, String originalData) {
|
||||
String data = originalData;
|
||||
try {
|
||||
if (logger != null) logger.trace("Applying string transformer to yaml data:" + data);
|
||||
if (logger != null) logger.trace(() -> "Applying string transformer to yaml data:" + originalData);
|
||||
for (Function<String, String> transformer : transformers) {
|
||||
data = transformer.apply(data);
|
||||
}
|
||||
@ -92,7 +92,7 @@ public class RawYamlLoader {
|
||||
protected String applyTransforms(Logger logger, String data) {
|
||||
for (Function<String, String> xform : stringTransformers) {
|
||||
try {
|
||||
if (logger != null) logger.trace("Applying string transformer to yaml data:" + xform);
|
||||
if (logger != null) logger.trace(() -> "Applying string transformer to yaml data:" + xform);
|
||||
data = xform.apply(data);
|
||||
} catch (Exception e) {
|
||||
RuntimeException t = new OpConfigError("Error applying string transforms to input", e);
|
||||
|
@ -138,7 +138,7 @@ public class CommandTemplate {
|
||||
for (Function<String, Map<String, String>> parser : parserlist) {
|
||||
Map<String, String> parsed = parser.apply(oneline);
|
||||
if (parsed != null) {
|
||||
logger.debug("parsed request: " + parsed);
|
||||
logger.debug(() -> "parsed request: " + parsed);
|
||||
cmd.putAll(parsed);
|
||||
didParse = true;
|
||||
break;
|
||||
|
@ -144,11 +144,11 @@ public class NBWebServer implements Runnable {
|
||||
svcLoader.getNamedProviders().stream().map(p -> p.provider)
|
||||
.forEach(p -> {
|
||||
Class<? extends WebServiceObject> c = p.type();
|
||||
logger.info("Adding web service object: " + c.getSimpleName());
|
||||
logger.info(() -> "Adding web service object: " + c.getSimpleName());
|
||||
this.addWebObject(c);
|
||||
});
|
||||
|
||||
logger.debug("Loaded " + this.servletClasses.size() + " root resources.");
|
||||
logger.debug(() -> "Loaded " + this.servletClasses.size() + " root resources.");
|
||||
|
||||
}
|
||||
|
||||
@ -177,7 +177,7 @@ public class NBWebServer implements Runnable {
|
||||
path.getFileSystem().provider().checkAccess(path, AccessMode.READ);
|
||||
this.basePaths.add(path);
|
||||
} catch (Exception e) {
|
||||
logger.error("Unable to access path " + path.toString());
|
||||
logger.error(() -> "Unable to access path " + path.toString());
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
@ -224,7 +224,7 @@ public class NBWebServer implements Runnable {
|
||||
}
|
||||
|
||||
for (Path basePath : basePaths) {
|
||||
logger.info("Adding path to server: " + basePath.toString());
|
||||
logger.info(() -> "Adding path to server: " + basePath.toString());
|
||||
ResourceHandler resourceHandler = new ResourceHandler();
|
||||
resourceHandler.setDirAllowed(true);
|
||||
resourceHandler.setAcceptRanges(true);
|
||||
@ -253,7 +253,7 @@ public class NBWebServer implements Runnable {
|
||||
// ServletHolder statusResourceServletHolder = new ServletHolder(statusResourceContainer);
|
||||
// getContextHandler().addServlet(statusResourceServletHolder, "/_");
|
||||
|
||||
logger.info("adding " + servletClasses.size() + " context handlers...");
|
||||
logger.info(() -> "adding " + servletClasses.size() + " context handlers...");
|
||||
loadDynamicEndpoints();
|
||||
|
||||
|
||||
@ -311,7 +311,7 @@ public class NBWebServer implements Runnable {
|
||||
server.setHandler(handlers);
|
||||
for (Connector connector : server.getConnectors()) {
|
||||
if (connector instanceof AbstractConnector) {
|
||||
logger.debug("Setting idle timeout for " + connector + " to 300,000ms");
|
||||
logger.debug(() -> "Setting idle timeout for " + connector + " to 300,000ms");
|
||||
((AbstractConnector) connector).setIdleTimeout(300000);
|
||||
}
|
||||
}
|
||||
@ -347,7 +347,7 @@ public class NBWebServer implements Runnable {
|
||||
|
||||
server.join();
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("error while starting doc server: "+e.toString(),e);
|
||||
throw new RuntimeException("error while starting doc server: "+ e,e);
|
||||
}
|
||||
|
||||
}
|
||||
@ -381,13 +381,11 @@ public class NBWebServer implements Runnable {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("----> handler type ").append(handler.getClass().getSimpleName()).append("\n");
|
||||
|
||||
if (handler instanceof ResourceHandler) {
|
||||
ResourceHandler h = (ResourceHandler) handler;
|
||||
if (handler instanceof ResourceHandler h) {
|
||||
sb.append(" base resource: ").append(h.getBaseResource().toString())
|
||||
.append("\n");
|
||||
sb.append(h.dump());
|
||||
} else if (handler instanceof ServletContextHandler) {
|
||||
ServletContextHandler h = (ServletContextHandler) handler;
|
||||
} else if (handler instanceof ServletContextHandler h) {
|
||||
sb.append(h.dump()).append("\n");
|
||||
h.getServletContext().getServletRegistrations().forEach(
|
||||
(k, v) -> {
|
||||
@ -396,8 +394,7 @@ public class NBWebServer implements Runnable {
|
||||
}
|
||||
);
|
||||
sb.append("context path:").append(h.getContextPath());
|
||||
} else if (handler instanceof DefaultHandler) {
|
||||
DefaultHandler h = (DefaultHandler) handler;
|
||||
} else if (handler instanceof DefaultHandler h) {
|
||||
sb.append(h.dump());
|
||||
}
|
||||
return sb.toString();
|
||||
|
@ -54,14 +54,14 @@ public class NBWebServerApp implements BundledApp {
|
||||
|
||||
StandardOpenOption[] OVERWRITE = {StandardOpenOption.TRUNCATE_EXISTING,StandardOpenOption.CREATE,StandardOpenOption.WRITE};
|
||||
|
||||
logger.info("generating to directory " + dirpath);
|
||||
logger.info(() -> "generating to directory " + dirpath);
|
||||
|
||||
|
||||
DocsysMarkdownEndpoint dds = new DocsysMarkdownEndpoint();
|
||||
String markdownList = dds.getMarkdownList(true);
|
||||
|
||||
Path markdownCsvPath = dirpath.resolve(Path.of("services/docs/markdown.csv"));
|
||||
logger.info("markdown.csv located at " + markdownCsvPath);
|
||||
logger.info(() -> "markdown.csv located at " + markdownCsvPath);
|
||||
|
||||
Files.createDirectories(markdownCsvPath.getParent());
|
||||
Files.writeString(markdownCsvPath, markdownList, OVERWRITE);
|
||||
@ -70,7 +70,7 @@ public class NBWebServerApp implements BundledApp {
|
||||
|
||||
for (String markdownFile : markdownFileArray) {
|
||||
Path relativePath = dirpath.resolve(Path.of("services/docs", markdownFile));
|
||||
logger.info("Creating " + relativePath);
|
||||
logger.info(() -> "Creating " + relativePath);
|
||||
|
||||
Path path = dds.findPath(markdownFile);
|
||||
// String markdown = dds.getFileByPath(markdownFile);
|
||||
@ -115,7 +115,7 @@ public class NBWebServerApp implements BundledApp {
|
||||
server.withContextParam("workspaces_root", workspaces_root);
|
||||
} else if (arg.matches("--logdir")) {
|
||||
String logdir_path = serverArgs[i + 1];
|
||||
logger.info("Setting docserver logdir to " + logdir_path);
|
||||
logger.info(() -> "Setting docserver logdir to " + logdir_path);
|
||||
server.withContextParam("logpath", Path.of(logdir_path));
|
||||
}
|
||||
}
|
||||
@ -150,10 +150,10 @@ public class NBWebServerApp implements BundledApp {
|
||||
} else if (args.length > 0 && args[0].contains("generate")) {
|
||||
try {
|
||||
String[] genargs = Arrays.copyOfRange(args, 1, args.length);
|
||||
logger.info("Generating with args [" + String.join("][", args) + "]");
|
||||
logger.info(() -> "Generating with args [" + String.join("][", args) + "]");
|
||||
generate(genargs);
|
||||
} catch (IOException e) {
|
||||
logger.error("could not generate files with command " + String.join(" ", args));
|
||||
logger.error(() -> "could not generate files with command " + String.join(" ", args));
|
||||
e.printStackTrace();
|
||||
}
|
||||
} else {
|
||||
|
@ -52,7 +52,7 @@ public abstract class JmxOp implements Op,Runnable {
|
||||
protected Object readObject(String attributeName) {
|
||||
try {
|
||||
Object value = getMBeanConnection().getAttribute(objectName, attributeName);
|
||||
logger.trace("read attribute '" + value + "': " + value);
|
||||
logger.trace(() -> "read attribute '" + value + "': " + value);
|
||||
return value;
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
|
@ -65,7 +65,7 @@ public abstract class BaseAsyncAction<D, A extends Activity> implements AsyncAct
|
||||
|
||||
@Override
|
||||
public void requestStop() {
|
||||
logger.info(this + " requested to stop.");
|
||||
logger.info(() -> this + " requested to stop.");
|
||||
this.running = false;
|
||||
}
|
||||
|
||||
|
@ -53,7 +53,7 @@ public class EnumReadableMappingFilter<E extends Enum<E> & ResultReadable> imple
|
||||
for (E enumValue : enumValues) {
|
||||
if (enumValue.toString().matches(p.pattern())) {
|
||||
matched++;
|
||||
logger.debug("Setting policy for " + enumValue + " to " + policy);
|
||||
logger.debug(() -> "Setting policy for " + enumValue + " to " + policy);
|
||||
int resultCode = enumValue.getResult();
|
||||
arrayFilter.addPolicy(enumValue,policy);
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class ReorderingConcurrentResultBuffer implements Output, CanFilterResult
|
||||
segmentCount++;
|
||||
currentCount+=segment.getCount();
|
||||
if (currentCount>=threshold) {
|
||||
logger.trace("Reordering threshold met: " + currentCount +"/" + threshold + ", sorting and pushing. (" + segments.size() + " segments)");
|
||||
logger.trace(() -> "Reordering threshold met: " + currentCount +"/" + threshold + ", sorting and pushing. (" + segments.size() + " segments)");
|
||||
Collections.sort(segments);
|
||||
while(currentCount>=threshold) {
|
||||
CycleResultsSegment head = segments.removeFirst();
|
||||
@ -85,7 +85,7 @@ public class ReorderingConcurrentResultBuffer implements Output, CanFilterResult
|
||||
|
||||
@Override
|
||||
public synchronized void close() throws Exception {
|
||||
logger.trace("closing and flushing " + segments.size() + " segments");
|
||||
logger.trace(() -> "closing and flushing " + segments.size() + " segments");
|
||||
Collections.sort(segments);
|
||||
for (CycleResultsSegment segment : segments) {
|
||||
downstream.onCycleResultSegment(segment);
|
||||
|
@ -121,12 +121,12 @@ public class CycleLogOutput implements Output, CanFilterResultValue {
|
||||
+ (nextFileExtent.remaining() / CycleResultsRLEBufferTarget.BYTES)
|
||||
+ ") tuples");
|
||||
int targetCapacity = (mbb == null ? 0 : mbb.capacity()) + nextFileExtent.remaining();
|
||||
logger.trace("ensuring capacity for " + targetCapacity);
|
||||
logger.trace(() -> "ensuring capacity for " + targetCapacity);
|
||||
this.ensureCapacity(targetCapacity);
|
||||
mbb.put(nextFileExtent);
|
||||
mbb.force();
|
||||
logger.trace("extent appended");
|
||||
logger.trace("mbb position now at " + mbb.position());
|
||||
logger.trace(() -> "mbb position now at " + mbb.position());
|
||||
|
||||
}
|
||||
|
||||
@ -148,7 +148,7 @@ public class CycleLogOutput implements Output, CanFilterResultValue {
|
||||
|
||||
private synchronized void ensureCapacity(long newCapacity) {
|
||||
try {
|
||||
logger.info("resizing marking file from " + (mbb == null ? 0 : mbb.capacity()) + " to " + newCapacity);
|
||||
logger.info(() -> "resizing marking file from " + (mbb == null ? 0 : mbb.capacity()) + " to " + newCapacity);
|
||||
if (file == null) {
|
||||
file = new RandomAccessFile(outputFile, "rw");
|
||||
file.seek(0);
|
||||
@ -160,7 +160,7 @@ public class CycleLogOutput implements Output, CanFilterResultValue {
|
||||
mbb = file.getChannel().map(FileChannel.MapMode.READ_WRITE, 0, newCapacity);
|
||||
mbb.position(pos);
|
||||
}
|
||||
logger.trace("mbb position now at " + mbb.position());
|
||||
logger.trace(() -> "mbb position now at " + mbb.position());
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
|
@ -48,7 +48,7 @@ public class LoggingOutput implements Output,CanFilterResultValue {
|
||||
.append("activity=").append(def.getAlias())
|
||||
.append(",cycle=").append(completedCycle)
|
||||
.append(",result=").append((byte) (result & 127));
|
||||
logger.info(sb.get().toString());
|
||||
logger.info(() -> sb.get().toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -29,11 +29,11 @@ public class RateLimiters {
|
||||
if (extant == null) {
|
||||
RateLimiter rateLimiter= new HybridRateLimiter(def, label, spec);
|
||||
|
||||
logger.info("Using rate limiter: " + rateLimiter);
|
||||
logger.info(() -> "Using rate limiter: " + rateLimiter);
|
||||
return rateLimiter;
|
||||
} else {
|
||||
extant.applyRateSpec(spec);
|
||||
logger.info("Updated rate limiter: " + extant);
|
||||
logger.info(() -> "Updated rate limiter: " + extant);
|
||||
return extant;
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class ThreadDrivenTokenPool implements TokenPool {
|
||||
*/
|
||||
public ThreadDrivenTokenPool(RateSpec rateSpec, NBNamedElement named) {
|
||||
apply(named,rateSpec);
|
||||
logger.debug("initialized token pool: " + this + " for rate:" + rateSpec);
|
||||
logger.debug(() -> "initialized token pool: " + this + " for rate:" + rateSpec);
|
||||
// filler.start();
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class SysPerfBaseliner {
|
||||
Collection<RunResult> jmhResults = sysPerfBaseliner.runBenchmarks();
|
||||
// logger.info("Results of JMH benchmarks:\n" + result.toString());
|
||||
// result.forEach(System.out::println);
|
||||
logger.info("SysPerfData (selected details for EB):\n" + new SysPerfData(jmhResults, SysPerfData.currentVersion));
|
||||
logger.info(() -> "SysPerfData (selected details for EB):\n" + new SysPerfData(jmhResults, SysPerfData.currentVersion));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -59,7 +59,7 @@ public class SysPerfBaseliner {
|
||||
try {
|
||||
String logfile = Files.createTempFile("jmh_" + n, ".log").toString();
|
||||
Options options = new OptionsBuilder().forks(1).include(c.getSimpleName()).output(logfile).build();
|
||||
logger.info("running microbench for " + n + ", for about 20 seconds; details in " + logfile);
|
||||
logger.info(() -> "running microbench for " + n + ", for about 20 seconds; details in " + logfile);
|
||||
RunResult runResult = new Runner(options).runSingle();
|
||||
results.add(runResult);
|
||||
} catch (Exception e) {
|
||||
@ -74,7 +74,7 @@ public class SysPerfBaseliner {
|
||||
logger.info("Running system calibration tests for about a minute. This is used to calibrate delay loops, and is done only once.");
|
||||
Collection<RunResult> runResult = runBenchmarks();
|
||||
SysPerfData sysPerfData = new SysPerfData(runResult, SysPerfData.currentVersion);
|
||||
logger.info("System timing test complete: " + sysPerfData);
|
||||
logger.info(() -> "System timing test complete: " + sysPerfData);
|
||||
return sysPerfData;
|
||||
}
|
||||
|
||||
|
@ -66,10 +66,10 @@ public class MotorState implements Supplier<RunState> {
|
||||
throw new RuntimeException("Invalid transition from " + from + " to " + to);
|
||||
}
|
||||
while (!atomicState.compareAndSet(from, to)) {
|
||||
logger.trace("retrying transition from:" + from + " to:" + to);
|
||||
logger.trace(() -> "retrying transition from:" + from + " to:" + to);
|
||||
}
|
||||
tally.change(from,to);
|
||||
logger.trace("TRANSITION[" + slotId + "]: " + from + " ==> " + to);
|
||||
logger.trace(() -> "TRANSITION[" + slotId + "]: " + from + " ==> " + to);
|
||||
}
|
||||
|
||||
public void removeState() {
|
||||
|
@ -220,7 +220,7 @@ public class SimpleActivity implements Activity, ProgressCapable, ActivityDefObs
|
||||
@Override
|
||||
public void closeAutoCloseables() {
|
||||
for (AutoCloseable closeable : closeables) {
|
||||
logger.debug("CLOSING " + closeable.getClass().getCanonicalName() + ": " + closeable);
|
||||
logger.debug(() -> "CLOSING " + closeable.getClass().getCanonicalName() + ": " + closeable);
|
||||
try {
|
||||
closeable.close();
|
||||
} catch (Exception e) {
|
||||
@ -356,7 +356,7 @@ public class SimpleActivity implements Activity, ProgressCapable, ActivityDefObs
|
||||
Optional<String> strideOpt = getParams().getOptionalString("stride");
|
||||
if (strideOpt.isEmpty()) {
|
||||
String stride = String.valueOf(seq.getSequence().length);
|
||||
logger.info("defaulting stride to " + stride + " (the sequence length)");
|
||||
logger.info(() -> "defaulting stride to " + stride + " (the sequence length)");
|
||||
// getParams().set("stride", stride);
|
||||
getParams().setSilently("stride", stride);
|
||||
}
|
||||
@ -364,7 +364,7 @@ public class SimpleActivity implements Activity, ProgressCapable, ActivityDefObs
|
||||
Optional<String> cyclesOpt = getParams().getOptionalString("cycles");
|
||||
if (cyclesOpt.isEmpty()) {
|
||||
String cycles = getParams().getOptionalString("stride").orElseThrow();
|
||||
logger.info("defaulting cycles to " + cycles + " (the stride length)");
|
||||
logger.info(() -> "defaulting cycles to " + cycles + " (the stride length)");
|
||||
// getParams().set("cycles", getParams().getOptionalString("stride").orElseThrow());
|
||||
getParams().setSilently("cycles", getParams().getOptionalString("stride").orElseThrow());
|
||||
} else {
|
||||
@ -387,7 +387,7 @@ public class SimpleActivity implements Activity, ProgressCapable, ActivityDefObs
|
||||
long stride = getActivityDef().getParams().getOptionalLong("stride").orElseThrow();
|
||||
|
||||
if (stride > 0 && (cycleCount % stride) != 0) {
|
||||
logger.warn("The stride does not evenly divide cycles. Only full strides will be executed," +
|
||||
logger.warn(() -> "The stride does not evenly divide cycles. Only full strides will be executed," +
|
||||
"leaving some cycles unused. (stride=" + stride + ", cycles=" + cycleCount + ")");
|
||||
}
|
||||
|
||||
@ -408,23 +408,23 @@ public class SimpleActivity implements Activity, ProgressCapable, ActivityDefObs
|
||||
} else if (spec.toLowerCase().matches("\\d+x")) {
|
||||
String multiplier = spec.substring(0, spec.length() - 1);
|
||||
int threads = processors * Integer.parseInt(multiplier);
|
||||
logger.info("setting threads to " + threads + " (" + multiplier + "x)");
|
||||
logger.info(() -> "setting threads to " + threads + " (" + multiplier + "x)");
|
||||
// activityDef.setThreads(threads);
|
||||
activityDef.getParams().setSilently("threads", threads);
|
||||
} else if (spec.toLowerCase().matches("\\d+")) {
|
||||
logger.info("setting threads to " + spec + " (direct)");
|
||||
logger.info(() -> "setting threads to " + spec + " (direct)");
|
||||
// activityDef.setThreads(Integer.parseInt(spec));
|
||||
activityDef.getParams().setSilently("threads", Integer.parseInt(spec));
|
||||
}
|
||||
|
||||
if (activityDef.getThreads() > activityDef.getCycleCount()) {
|
||||
logger.warn("threads=" + activityDef.getThreads() + " and cycles=" + activityDef.getCycleSummary()
|
||||
logger.warn(() -> "threads=" + activityDef.getThreads() + " and cycles=" + activityDef.getCycleSummary()
|
||||
+ ", you should have more cycles than threads.");
|
||||
}
|
||||
|
||||
} else {
|
||||
if (cycleCount > 1000) {
|
||||
logger.warn("For testing at scale, it is highly recommended that you " +
|
||||
logger.warn(() -> "For testing at scale, it is highly recommended that you " +
|
||||
"set threads to a value higher than the default of 1." +
|
||||
" hint: you can use threads=auto for reasonable default, or" +
|
||||
" consult the topic on threads with `help threads` for" +
|
||||
@ -491,7 +491,7 @@ public class SimpleActivity implements Activity, ProgressCapable, ActivityDefObs
|
||||
long ratio = ratios.get(i);
|
||||
ParsedOp pop = pops.get(i);
|
||||
if (ratio == 0) {
|
||||
logger.info("skipped mapping op '" + pop.getName() + "'");
|
||||
logger.info(() -> "skipped mapping op '" + pop.getName() + "'");
|
||||
continue;
|
||||
}
|
||||
boolean dryrun = pop.takeStaticConfigOr("dryrun", false);
|
||||
|
@ -37,9 +37,9 @@ public class CoreAction implements SyncAction {
|
||||
@Override
|
||||
public int runCycle(long cycle) {
|
||||
if ((cycle % interval) == 0) {
|
||||
logger.info(activityDef.getAlias() + "[" + slot + "]: cycle=" + cycle);
|
||||
logger.info(() -> activityDef.getAlias() + "[" + slot + "]: cycle=" + cycle);
|
||||
} else {
|
||||
logger.trace(activityDef.getAlias() + "[" + slot + "]: cycle=" + cycle);
|
||||
logger.trace(() -> activityDef.getAlias() + "[" + slot + "]: cycle=" + cycle);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -69,13 +69,13 @@ public class AtomicInput implements Input, ActivityDefObserver, ProgressCapable
|
||||
long next = current + stride;
|
||||
if (next > max.get()) {
|
||||
if (recycleValue.get() >= recycleMax.get()) {
|
||||
logger.trace("Exhausted input for " + activityDef.getAlias() + " at " + current + ", recycle " +
|
||||
logger.trace(() -> "Exhausted input for " + activityDef.getAlias() + " at " + current + ", recycle " +
|
||||
"count " + recycleValue.get());
|
||||
return null;
|
||||
} else {
|
||||
if (cycleValue.compareAndSet(current, min.get() + stride)) {
|
||||
recycleValue.getAndIncrement();
|
||||
logger.trace("recycling input for " + activityDef.getAlias() + " recycle:" + recycleValue.get());
|
||||
logger.trace(() -> "recycling input for " + activityDef.getAlias() + " recycle:" + recycleValue.get());
|
||||
return new InputInterval.Segment(min.get(), min.get() + stride);
|
||||
}
|
||||
}
|
||||
|
@ -99,13 +99,13 @@ public class ContiguousOutputChunker implements Output {
|
||||
extent = extent.extend();
|
||||
logger.debug("added tracker extent " + extent.rangeSummary());
|
||||
}
|
||||
logger.info("using max " + maxExtents + " extents with getCount: " + extentSize);
|
||||
logger.info(() -> "using max " + maxExtents + " extents with getCount: " + extentSize);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public synchronized void onCycleResultSegment(CycleResultsSegment segment) {
|
||||
logger.trace("on-cycle-result-segment: (" + segment + ")");
|
||||
logger.trace(() -> "on-cycle-result-segment: (" + segment + ")");
|
||||
for (CycleResult cr : segment) {
|
||||
onCycleResult(cr.getCycle(), cr.getResult());
|
||||
}
|
||||
@ -113,7 +113,7 @@ public class ContiguousOutputChunker implements Output {
|
||||
|
||||
@Override
|
||||
public synchronized boolean onCycleResult(long completedCycle, int result) {
|
||||
logger.trace("on-cycle-result: (" + completedCycle + "," + result + ")");
|
||||
logger.trace(() -> "on-cycle-result: (" + completedCycle + "," + result + ")");
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
@ -174,7 +174,7 @@ public class ContiguousOutputChunker implements Output {
|
||||
}
|
||||
|
||||
private void onFullyFilled(ByteTrackerExtent extent) {
|
||||
logger.trace("MARKER>: fully filled: " + extent);
|
||||
logger.trace(() -> "MARKER>: fully filled: " + extent);
|
||||
for (Output reader : readers) {
|
||||
CycleResultsIntervalSegment remainingSegment = extent.getRemainingSegment();
|
||||
if (remainingSegment != null) {
|
||||
|
@ -200,10 +200,9 @@ public class CoreMotor<D> implements ActivityDefObserver, Motor<D>, Stoppable {
|
||||
|
||||
|
||||
if (motorState.get() == Finished) {
|
||||
logger.warn("Input was already exhausted for slot " + slotId + ", remaining in finished state.");
|
||||
logger.warn(() -> "Input was already exhausted for slot " + slotId + ", remaining in finished state.");
|
||||
}
|
||||
|
||||
long cyclenum;
|
||||
action.init();
|
||||
|
||||
if (input instanceof Startable) {
|
||||
@ -247,7 +246,7 @@ public class CoreMotor<D> implements ActivityDefObserver, Motor<D>, Stoppable {
|
||||
}
|
||||
|
||||
if (cycleSegment == null) {
|
||||
logger.trace("input exhausted (input " + input + ") via null segment, stopping motor thread " + slotId);
|
||||
logger.trace(() -> "input exhausted (input " + input + ") via null segment, stopping motor thread " + slotId);
|
||||
motorState.enterState(Finished);
|
||||
continue;
|
||||
}
|
||||
@ -270,17 +269,17 @@ public class CoreMotor<D> implements ActivityDefObserver, Motor<D>, Stoppable {
|
||||
long strideStart = System.nanoTime();
|
||||
|
||||
while (!cycleSegment.isExhausted() && motorState.get() == Running) {
|
||||
cyclenum = cycleSegment.nextCycle();
|
||||
long cyclenum = cycleSegment.nextCycle();
|
||||
if (cyclenum < 0) {
|
||||
if (cycleSegment.isExhausted()) {
|
||||
logger.trace("input exhausted (input " + input + ") via negative read, stopping motor thread " + slotId);
|
||||
logger.trace(() -> "input exhausted (input " + input + ") via negative read, stopping motor thread " + slotId);
|
||||
motorState.enterState(Finished);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (motorState.get() != Running) {
|
||||
logger.trace("motor stopped in cycle " + cyclenum + ", stopping motor thread " + slotId);
|
||||
logger.trace(()->"motor stopped in cycle " + cyclenum + ", stopping motor thread " + slotId);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -307,7 +306,7 @@ public class CoreMotor<D> implements ActivityDefObserver, Motor<D>, Stoppable {
|
||||
async.enqueue(op);
|
||||
|
||||
} catch (Exception t) {
|
||||
logger.error("Error while processing async cycle " + cyclenum + ", error:" + t);
|
||||
logger.error(()->"Error while processing async cycle " + cyclenum + ", error:" + t);
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
@ -318,9 +317,9 @@ public class CoreMotor<D> implements ActivityDefObserver, Motor<D>, Stoppable {
|
||||
if (motorState.get() == Finished) {
|
||||
boolean finished = opTracker.awaitCompletion(60000);
|
||||
if (finished) {
|
||||
logger.debug("slot " + this.slotId + " completed successfully");
|
||||
logger.debug(() -> "slot " + this.slotId + " completed successfully");
|
||||
} else {
|
||||
logger.warn("slot " + this.slotId + " was stopped before completing successfully");
|
||||
logger.warn(() -> "slot " + this.slotId + " was stopped before completing successfully");
|
||||
}
|
||||
}
|
||||
|
||||
@ -349,7 +348,7 @@ public class CoreMotor<D> implements ActivityDefObserver, Motor<D>, Stoppable {
|
||||
}
|
||||
|
||||
if (cycleSegment == null) {
|
||||
logger.trace("input exhausted (input " + input + ") via null segment, stopping motor thread " + slotId);
|
||||
logger.trace(() -> "input exhausted (input " + input + ") via null segment, stopping motor thread " + slotId);
|
||||
motorState.enterState(Finished);
|
||||
continue;
|
||||
}
|
||||
@ -364,17 +363,17 @@ public class CoreMotor<D> implements ActivityDefObserver, Motor<D>, Stoppable {
|
||||
try {
|
||||
|
||||
while (!cycleSegment.isExhausted()) {
|
||||
cyclenum = cycleSegment.nextCycle();
|
||||
long cyclenum = cycleSegment.nextCycle();
|
||||
if (cyclenum < 0) {
|
||||
if (cycleSegment.isExhausted()) {
|
||||
logger.trace("input exhausted (input " + input + ") via negative read, stopping motor thread " + slotId);
|
||||
logger.trace(() -> "input exhausted (input " + input + ") via negative read, stopping motor thread " + slotId);
|
||||
motorState.enterState(Finished);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (motorState.get() != Running) {
|
||||
logger.trace("motor stopped after input (input " + cyclenum + "), stopping motor thread " + slotId);
|
||||
logger.trace(() -> "motor stopped after input (input " + cyclenum + "), stopping motor thread " + slotId);
|
||||
continue;
|
||||
}
|
||||
int result = -1;
|
||||
@ -386,7 +385,7 @@ public class CoreMotor<D> implements ActivityDefObserver, Motor<D>, Stoppable {
|
||||
|
||||
long cycleStart = System.nanoTime();
|
||||
try {
|
||||
logger.trace("cycle " + cyclenum);
|
||||
logger.trace(()->"cycle " + cyclenum);
|
||||
|
||||
// runCycle
|
||||
long phaseStart = System.nanoTime();
|
||||
@ -413,7 +412,7 @@ public class CoreMotor<D> implements ActivityDefObserver, Motor<D>, Stoppable {
|
||||
try {
|
||||
output.onCycleResultSegment(outputBuffer);
|
||||
} catch (Exception t) {
|
||||
logger.error("Error while feeding result segment " + outputBuffer + " to output '" + output + "', error:" + t);
|
||||
logger.error(()->"Error while feeding result segment " + outputBuffer + " to output '" + output + "', error:" + t);
|
||||
throw t;
|
||||
}
|
||||
}
|
||||
@ -429,11 +428,11 @@ public class CoreMotor<D> implements ActivityDefObserver, Motor<D>, Stoppable {
|
||||
} else if (motorState.get() == Finished) {
|
||||
logger.trace(() -> Thread.currentThread().getName() + " shutting down as " + motorState.get());
|
||||
} else {
|
||||
logger.warn("Unexpected motor state for CoreMotor shutdown: " + motorState.get());
|
||||
logger.warn(()->"Unexpected motor state for CoreMotor shutdown: " + motorState.get());
|
||||
}
|
||||
|
||||
} catch (Throwable t) {
|
||||
logger.error("Error in core motor loop:" + t, t);
|
||||
logger.error(()->"Error in core motor loop:" + t, t);
|
||||
motorState.enterState(Errored);
|
||||
throw t;
|
||||
}
|
||||
@ -471,7 +470,7 @@ public class CoreMotor<D> implements ActivityDefObserver, Motor<D>, Stoppable {
|
||||
motorState.enterState(RunState.Stopping);
|
||||
} else {
|
||||
if (motorState.get() != Stopped && motorState.get() != Stopping) {
|
||||
logger.warn("attempted to stop motor " + this.getSlotId() + ": from non Running state:" + motorState.get());
|
||||
logger.warn(()->"attempted to stop motor " + this.getSlotId() + ": from non Running state:" + motorState.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class StrideTracker<D> extends Buffer<CompletedOp<D>> implements OpEvents
|
||||
*/
|
||||
public void onFull() {
|
||||
strideOp.succeed(0);
|
||||
logger.trace("completed strideOp with first result cycle (" + strideOp.getCycle() + ")");
|
||||
logger.trace(() -> "completed strideOp with first result cycle (" + strideOp.getCycle() + ")");
|
||||
strideServiceTimer.update(strideOp.getResponseTimeNanos(), TimeUnit.NANOSECONDS);
|
||||
if (strideResponseTimer!=null) {
|
||||
strideResponseTimer.update(strideOp.getResponseTimeNanos(),TimeUnit.NANOSECONDS);
|
||||
|
@ -126,7 +126,7 @@ public class StandardAction<A extends StandardActivity<R, ?>, R extends Op> impl
|
||||
triesHistogram.update(tries);
|
||||
|
||||
if (op instanceof OpGenerator) {
|
||||
logger.trace("GEN OP for cycle(" + cycle + ")");
|
||||
logger.trace(() -> "GEN OP for cycle(" + cycle + ")");
|
||||
op = ((OpGenerator) op).getNextOp();
|
||||
} else {
|
||||
op = null;
|
||||
|
@ -208,12 +208,12 @@ public class NBCLIScenarioParser {
|
||||
alias = (alias.startsWith("alias=") ? alias : "alias=" + alias);
|
||||
buildingCmd.put("alias", alias);
|
||||
|
||||
logger.debug("rebuilt command: " + String.join(" ", buildingCmd.values()));
|
||||
logger.debug(() -> "rebuilt command: " + String.join(" ", buildingCmd.values()));
|
||||
buildCmdBuffer.addAll(buildingCmd.values());
|
||||
}
|
||||
}
|
||||
buildCmdBuffer.descendingIterator().forEachRemaining(arglist::addFirst);
|
||||
logger.debug("composed command line args to fulfill named scenario: " + arglist);
|
||||
logger.debug(() -> "composed command line args to fulfill named scenario: " + arglist);
|
||||
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ public class CpuInfoTest {
|
||||
public void testProcScanner() {
|
||||
Optional<CpuInfo.ProcDetails> procDetails = CpuInfo.getProcDetails();
|
||||
assertThat(procDetails).isPresent();
|
||||
System.out.println(procDetails.get());
|
||||
// System.out.println(procDetails.get());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -133,7 +133,7 @@ public class AggregateTests {
|
||||
|
||||
logger.debug("proto[" + i + "] = ");
|
||||
for (double v : prototype) {
|
||||
logger.trace(String.format("% 3.0f ",v));
|
||||
logger.trace(() -> String.format("% 3.0f ",v));
|
||||
}
|
||||
series[i]=resampleCurve(prototype,100);
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ public class BasicScriptBuffer implements ScriptBuffer {
|
||||
String scriptData;
|
||||
String script_path = cmd.getArg("script_path");
|
||||
|
||||
logger.debug("Looking for " + script_path);
|
||||
logger.debug(() -> "Looking for " + script_path);
|
||||
|
||||
Content<?> one = NBIO.all().prefix("scripts").name(script_path).extension("js").one();
|
||||
scriptData = one.asString();
|
||||
|
@ -150,7 +150,7 @@ public class Cmd {
|
||||
"command '" + cmdName + " requires a value for " + arg.name
|
||||
+ ", but there were no remaining arguments after it.");
|
||||
} else if (arg.freeform) {
|
||||
logger.debug("freeform parameter:" + nextarg);
|
||||
logger.debug(() -> "freeform parameter:" + nextarg);
|
||||
} else if (nextarg.contains("=")) {
|
||||
throw new InvalidParameterException(
|
||||
"command '" + cmdName + "' requires a value for " + arg.name + "" +
|
||||
@ -161,7 +161,7 @@ public class Cmd {
|
||||
+ ", but a reserved word was found instead: " + nextarg);
|
||||
}
|
||||
|
||||
logger.debug("cmd name:" + cmdName + ", positional " + arg.name + ": " + nextarg);
|
||||
logger.debug(() -> "cmd name:" + cmdName + ", positional " + arg.name + ": " + nextarg);
|
||||
params.put(arg.name, arg.converter.apply(arglist.removeFirst()).toString());
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ public class NBCLI implements Function<String[], Integer> {
|
||||
|
||||
logger = LogManager.getLogger("NBCLI");
|
||||
loggerConfig.purgeOldFiles(LogManager.getLogger("SCENARIO"));
|
||||
logger.info("Configured scenario log at " + loggerConfig.getLogfileLocation());
|
||||
logger.info(() -> "Configured scenario log at " + loggerConfig.getLogfileLocation());
|
||||
logger.debug("Scenario log started");
|
||||
|
||||
// Global only processing
|
||||
@ -174,9 +174,9 @@ public class NBCLI implements Function<String[], Integer> {
|
||||
return EXIT_OK;
|
||||
}
|
||||
|
||||
logger.info("Running NoSQLBench Version " + new VersionInfo().getVersion());
|
||||
logger.info("command-line: " + Arrays.stream(args).collect(Collectors.joining(" ")));
|
||||
logger.info("client-hardware: " + SystemId.getHostSummary());
|
||||
logger.info(() -> "Running NoSQLBench Version " + new VersionInfo().getVersion());
|
||||
logger.info(() -> "command-line: " + Arrays.stream(args).collect(Collectors.joining(" ")));
|
||||
logger.info(() -> "client-hardware: " + SystemId.getHostSummary());
|
||||
|
||||
|
||||
// Invoke any bundled app which matches the name of the first non-option argument, if it exists.
|
||||
@ -186,7 +186,7 @@ public class NBCLI implements Function<String[], Integer> {
|
||||
BundledApp app = apploader.get().orElse(null);
|
||||
if (app != null) {
|
||||
String[] appargs = Arrays.copyOfRange(args, 1, args.length);
|
||||
logger.info("invoking bundled app '" + args[0] + "' (" + app.getClass().getSimpleName() + ").");
|
||||
logger.info(() -> "invoking bundled app '" + args[0] + "' (" + app.getClass().getSimpleName() + ").");
|
||||
globalOptions.setWantsStackTraces(true);
|
||||
int result = app.applyAsInt(appargs);
|
||||
return result;
|
||||
@ -299,7 +299,7 @@ public class NBCLI implements Function<String[], Integer> {
|
||||
|
||||
if (options.wantsToCopyResource()) {
|
||||
String resourceToCopy = options.wantsToCopyResourceNamed();
|
||||
logger.debug("user requests to copy out " + resourceToCopy);
|
||||
logger.debug(() -> "user requests to copy out " + resourceToCopy);
|
||||
|
||||
Optional<Content<?>> tocopy = NBIO.classpath()
|
||||
.prefix("activities")
|
||||
@ -329,7 +329,7 @@ public class NBCLI implements Function<String[], Integer> {
|
||||
} catch (IOException e) {
|
||||
throw new BasicError("Unable to write to " + writeTo + ": " + e.getMessage());
|
||||
}
|
||||
logger.info("Copied internal resource '" + data.asPath() + "' to '" + writeTo + "'");
|
||||
logger.info(() -> "Copied internal resource '" + data.asPath() + "' to '" + writeTo + "'");
|
||||
return EXIT_OK;
|
||||
|
||||
}
|
||||
@ -418,12 +418,12 @@ public class NBCLI implements Function<String[], Integer> {
|
||||
}
|
||||
|
||||
// intentionally not shown for warn-only
|
||||
logger.info("console logging level is " + options.getConsoleLogLevel());
|
||||
logger.info(() -> "console logging level is " + options.getConsoleLogLevel());
|
||||
|
||||
ScenariosExecutor scenariosExecutor = new ScenariosExecutor("executor-" + sessionName, 1);
|
||||
if (options.getConsoleLogLevel().isGreaterOrEqualTo(NBLogLevel.WARN)) {
|
||||
options.setWantsStackTraces(true);
|
||||
logger.debug("enabling stack traces since log level is " + options.getConsoleLogLevel());
|
||||
logger.debug(() -> "enabling stack traces since log level is " + options.getConsoleLogLevel());
|
||||
}
|
||||
|
||||
Scenario scenario = new Scenario(
|
||||
@ -479,7 +479,7 @@ public class NBCLI implements Function<String[], Integer> {
|
||||
// }
|
||||
|
||||
ScenariosResults scenariosResults = scenariosExecutor.awaitAllResults();
|
||||
logger.debug("Total of " + scenariosResults.getSize() + " result object returned from ScenariosExecutor");
|
||||
logger.debug(() -> "Total of " + scenariosResults.getSize() + " result object returned from ScenariosExecutor");
|
||||
|
||||
ActivityMetrics.closeMetrics(options.wantsEnableChart());
|
||||
scenariosResults.reportToLog();
|
||||
|
@ -192,11 +192,11 @@ public class NBCLIArgsFile {
|
||||
LinkedHashSet<String> mergedPins = mergePins(this.argsToPin, this.argsToUnpin, extant);
|
||||
if (extant.equals(mergedPins)) {
|
||||
if (logger != null) {
|
||||
logger.info("Pinning resulted in no changes to argsfile '" + this.argsPath.toString() + "'");
|
||||
logger.info(() -> "Pinning resulted in no changes to argsfile '" + this.argsPath.toString() + "'");
|
||||
}
|
||||
} else {
|
||||
if (logger != null) {
|
||||
logger.info("Writing updated argsfile '" + this.argsPath.toString() + "' with " +
|
||||
logger.info(() -> "Writing updated argsfile '" + this.argsPath.toString() + "' with " +
|
||||
(this.argsToPin.size() + this.argsToUnpin.size()) + " changes");
|
||||
}
|
||||
writeArgsFile(mergedPins);
|
||||
@ -232,11 +232,11 @@ public class NBCLIArgsFile {
|
||||
for (String toAdd : toPin) {
|
||||
if (merged.contains(toAdd)) {
|
||||
if (logger != null) {
|
||||
logger.warn("Requested to pin argument again: '" + toAdd + "', ignoring");
|
||||
logger.warn(() -> "Requested to pin argument again: '" + toAdd + "', ignoring");
|
||||
}
|
||||
} else {
|
||||
if (logger != null) {
|
||||
logger.info("Pinning option '" + toAdd + "' to '" + this.argsPath.toString() + "'");
|
||||
logger.info(() -> "Pinning option '" + toAdd + "' to '" + this.argsPath.toString() + "'");
|
||||
}
|
||||
merged.add(toAdd);
|
||||
}
|
||||
@ -245,12 +245,12 @@ public class NBCLIArgsFile {
|
||||
for (String toDel : toUnpin) {
|
||||
if (merged.contains(toDel)) {
|
||||
if (logger != null) {
|
||||
logger.info("Unpinning '" + toDel + "' from '" + this.argsPath.toString() + "'");
|
||||
logger.info(() -> "Unpinning '" + toDel + "' from '" + this.argsPath.toString() + "'");
|
||||
}
|
||||
merged.remove(toDel);
|
||||
} else {
|
||||
if (logger != null) {
|
||||
logger.warn("Requested to unpin argument '" + toDel + "' which was not found in " + argsPath.toString());
|
||||
logger.warn(() -> "Requested to unpin argument '" + toDel + "' which was not found in " + argsPath.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -422,7 +422,7 @@ public class NBCLIArgsFile {
|
||||
|
||||
this.argsPath = selected;
|
||||
if (logger != null) {
|
||||
logger.debug("argsfile path is now '" + this.argsPath + "'");
|
||||
logger.debug(() -> "argsfile path is now '" + this.argsPath + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -50,14 +50,14 @@ public class PathCanonicalizer {
|
||||
logger.info("rewrote path for " + path + " as " + rewriteTo);
|
||||
return rewriteTo;
|
||||
} else {
|
||||
logger.trace("kept path for " + path + " as " + found.get().asPath().toString());
|
||||
logger.trace(() -> "kept path for " + path + " as " + found.get().asPath().toString());
|
||||
return path;
|
||||
}
|
||||
} else {
|
||||
logger.trace("kept path for " + path + " as " + found.get().asPath().toString());
|
||||
logger.trace(() -> "kept path for " + path + " as " + found.get().asPath().toString());
|
||||
}
|
||||
} else {
|
||||
logger.trace("unable to find " + path + " for path qualification, either it is remote or missing.");
|
||||
logger.trace(() -> "unable to find " + path + " for path qualification, either it is remote or missing.");
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public class RawSocketInjector {
|
||||
rqbuf.flip();
|
||||
|
||||
String requestContent = rqbuf.toString();
|
||||
logger.trace("authorizer request:\n" + requestContent + "\n");
|
||||
logger.trace(() -> "authorizer request:\n" + requestContent + "\n");
|
||||
toServer.write(requestContent.getBytes(StandardCharsets.UTF_8));
|
||||
toServer.flush();
|
||||
|
||||
@ -95,7 +95,7 @@ public class RawSocketInjector {
|
||||
String response = inbuf.toString();
|
||||
|
||||
|
||||
logger.trace("authorizer response:\n" + response + "\n");
|
||||
logger.trace(() -> "authorizer response:\n" + response + "\n");
|
||||
String[] headersAndBody = response.split("\r\n\r\n", 2);
|
||||
String[] statusAndHeaders = headersAndBody[0].split("\r\n", 2);
|
||||
if (!statusAndHeaders[0].contains("200 OK")) {
|
||||
@ -113,7 +113,7 @@ public class RawSocketInjector {
|
||||
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
ApiToken apiToken = gson.fromJson(headersAndBody[1], ApiToken.class);
|
||||
logger.info("Authorized local grafana client with Socket client: " + apiToken.toString());
|
||||
logger.info(() -> "Authorized local grafana client with Socket client: " + apiToken.toString());
|
||||
return Optional.of(apiToken);
|
||||
|
||||
} catch (Exception e) {
|
||||
|
@ -71,13 +71,11 @@ public class Annotators {
|
||||
}
|
||||
Annotator annotator = annotatorProvider.get();
|
||||
|
||||
if (annotator instanceof NBMapConfigurable) {
|
||||
NBMapConfigurable NBMapConfigurable = (NBMapConfigurable) annotator;
|
||||
if (annotator instanceof NBMapConfigurable NBMapConfigurable) {
|
||||
NBMapConfigurable.applyConfig(cmap);
|
||||
}
|
||||
|
||||
if (annotator instanceof NBConfigurable) {
|
||||
NBConfigurable nbConfigurable = (NBConfigurable) annotator;
|
||||
if (annotator instanceof NBConfigurable nbConfigurable) {
|
||||
NBConfiguration cfg = nbConfigurable.getConfigModel().apply(cmap);
|
||||
nbConfigurable.applyConfig(cfg);
|
||||
}
|
||||
@ -87,7 +85,7 @@ public class Annotators {
|
||||
|
||||
}
|
||||
|
||||
logger.debug("Initialized " + Annotators.annotators.size() + " annotators, since the configuration is empty.");
|
||||
logger.debug(() -> "Initialized " + Annotators.annotators.size() + " annotators, since the configuration is empty.");
|
||||
|
||||
}
|
||||
|
||||
@ -124,7 +122,7 @@ public class Annotators {
|
||||
public static synchronized void recordAnnotation(Annotation annotation) {
|
||||
for (Annotator annotator : getAnnotators()) {
|
||||
try {
|
||||
logger.trace("calling annotator " + annotator.getClass().getAnnotation(Service.class).selector());
|
||||
logger.trace(() -> "calling annotator " + annotator.getClass().getAnnotation(Service.class).selector());
|
||||
annotator.recordAnnotation(annotation);
|
||||
} catch (Exception e) {
|
||||
logger.error(e);
|
||||
|
@ -89,7 +89,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
||||
* Simply stop the motors
|
||||
*/
|
||||
public void stopActivity() {
|
||||
logger.info("stopping activity in progress: " + this.getActivityDef().getAlias());
|
||||
logger.info(() -> "stopping activity in progress: " + this.getActivityDef().getAlias());
|
||||
activity.setRunState(RunState.Stopping);
|
||||
motors.forEach(Motor::requestStop);
|
||||
tally.awaitNoneOther(RunState.Stopped,RunState.Finished);
|
||||
@ -98,7 +98,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
||||
tally.awaitNoneOther(RunState.Stopped,RunState.Finished);
|
||||
activity.setRunState(RunState.Stopped);
|
||||
|
||||
logger.info("stopped: " + this.getActivityDef().getAlias() + " with " + motors.size() + " slots");
|
||||
logger.info(() -> "stopped: " + this.getActivityDef().getAlias() + " with " + motors.size() + " slots");
|
||||
|
||||
Annotators.recordAnnotation(Annotation.newBuilder()
|
||||
.session(sessionId)
|
||||
@ -136,11 +136,11 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
||||
logger.debug("took " + (gracefulWaitEndedAt - gracefulWaitStartedAt) + " ms to shutdown gracefully");
|
||||
|
||||
if (!executorService.isTerminated()) {
|
||||
logger.info("stopping activity forcibly " + activity.getAlias());
|
||||
logger.info(() -> "stopping activity forcibly " + activity.getAlias());
|
||||
List<Runnable> runnables = executorService.shutdownNow();
|
||||
long forcibleShutdownCompletedAt = System.currentTimeMillis();
|
||||
logger.debug("took " + (forcibleShutdownCompletedAt - gracefulWaitEndedAt) + " ms to shutdown forcibly");
|
||||
logger.debug(runnables.size() + " tasks never started.");
|
||||
logger.debug(() -> "took " + (forcibleShutdownCompletedAt - gracefulWaitEndedAt) + " ms to shutdown forcibly");
|
||||
logger.debug(() -> runnables.size() + " tasks never started.");
|
||||
}
|
||||
|
||||
long activityShutdownStartedAt = System.currentTimeMillis();
|
||||
@ -336,7 +336,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
||||
|
||||
|
||||
private void requestStopMotors() {
|
||||
logger.info("stopping activity " + activity);
|
||||
logger.info(() -> "stopping activity " + activity);
|
||||
activity.setRunState(RunState.Stopping);
|
||||
motors.forEach(Motor::requestStop);
|
||||
}
|
||||
@ -358,7 +358,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
||||
|
||||
@Override
|
||||
public synchronized void stopActivityWithReasonAsync(String reason) {
|
||||
logger.info("Stopping activity " + this.activityDef.getAlias() + ": " + reason);
|
||||
logger.info(() -> "Stopping activity " + this.activityDef.getAlias() + ": " + reason);
|
||||
this.exception = new RuntimeException("Stopping activity " + this.activityDef.getAlias() + ": " + reason);
|
||||
logger.error("stopping with reason: " + exception);
|
||||
requestStopMotors();
|
||||
@ -491,7 +491,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
|
||||
*/
|
||||
private void startRunningActivityThreads() {
|
||||
|
||||
logger.info("starting activity " + activity.getAlias() + " for cycles " + activity.getCycleSummary());
|
||||
logger.info(() -> "starting activity " + activity.getAlias() + " for cycles " + activity.getCycleSummary());
|
||||
Annotators.recordAnnotation(Annotation.newBuilder()
|
||||
.session(sessionId)
|
||||
.now()
|
||||
|
@ -220,7 +220,7 @@ public class Scenario implements Callable<ExecutionMetricsResult> {
|
||||
|
||||
for (ScriptingPluginInfo<?> extensionDescriptor : SandboxExtensionFinder.findAll()) {
|
||||
if (!extensionDescriptor.isAutoLoading()) {
|
||||
logger.info("Not loading " + extensionDescriptor + ", autoloading is false");
|
||||
logger.info(() -> "Not loading " + extensionDescriptor + ", autoloading is false");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -232,7 +232,7 @@ public class Scenario implements Callable<ExecutionMetricsResult> {
|
||||
scriptEnv
|
||||
);
|
||||
ScenarioMetadataAware.apply(extensionObject, getScenarioMetadata());
|
||||
logger.trace("Adding extension object: name=" + extensionDescriptor.getBaseVariableName() +
|
||||
logger.trace(() -> "Adding extension object: name=" + extensionDescriptor.getBaseVariableName() +
|
||||
" class=" + extensionObject.getClass().getSimpleName());
|
||||
scriptEngine.put(extensionDescriptor.getBaseVariableName(), extensionObject);
|
||||
}
|
||||
@ -356,7 +356,7 @@ public class Scenario implements Callable<ExecutionMetricsResult> {
|
||||
logger.warn("Scenario was interrupted by process exit, shutting down");
|
||||
}
|
||||
|
||||
logger.info("scenario state: " + this.state);
|
||||
logger.info(() -> "scenario state: " + this.state);
|
||||
|
||||
// We report the scenario state via annotation even for short runs
|
||||
Annotation annotation = Annotation.newBuilder()
|
||||
|
@ -309,7 +309,7 @@ public class ScenarioController {
|
||||
* @return true, if all activities completed before the timer expired, false otherwise
|
||||
*/
|
||||
public boolean awaitCompletion(long waitTimeMillis) {
|
||||
logger.debug(() -> "awaiting completion");
|
||||
logger.debug("awaiting completion");
|
||||
boolean completed = true;
|
||||
for (ActivityRuntimeInfo activityRuntimeInfo : this.activityInfoMap.values()) {
|
||||
ExecutionResult activityResult = activityRuntimeInfo.awaitResult(waitTimeMillis);
|
||||
|
@ -99,7 +99,7 @@ public class ScenariosExecutor {
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
}
|
||||
logger.trace("waited " + (System.currentTimeMillis()-waitFrom) + " millis for scenarios");
|
||||
logger.trace(() -> "waited " + (System.currentTimeMillis()-waitFrom) + " millis for scenarios");
|
||||
updateAt = Math.min(timeoutAt, System.currentTimeMillis() + updateInterval);
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ public class ScenariosExecutor {
|
||||
Optional<Scenario> pendingScenario = getPendingScenario(scenarioName);
|
||||
if (pendingScenario.isPresent()) {
|
||||
submitted.remove(scenarioName);
|
||||
logger.info("cancelled scenario " + scenarioName);
|
||||
logger.info(() -> "cancelled scenario " + scenarioName);
|
||||
} else {
|
||||
throw new RuntimeException("Unable to cancel scenario: " + scenarioName + ": not found");
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ public class ScenariosResults {
|
||||
Scenario scenario = entry.getKey();
|
||||
ExecutionMetricsResult oresult = entry.getValue();
|
||||
|
||||
logger.info("results for scenario: " + scenario);
|
||||
logger.info(() -> "results for scenario: " + scenario);
|
||||
|
||||
if (oresult != null) {
|
||||
oresult.reportElapsedMillisToLog();
|
||||
|
@ -62,7 +62,7 @@ public class MetricsMapper {
|
||||
List<String> metricsDetails = new ArrayList<>();
|
||||
|
||||
ActivityDef activityDef = ActivityDef.parseActivityDef(activitySpec);
|
||||
logger.info("introspecting metric names for " + activitySpec);
|
||||
logger.info(() -> "introspecting metric names for " + activitySpec);
|
||||
|
||||
Optional<ActivityType> activityType = new ActivityTypeLoader().load(activityDef);
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class ScriptParams extends HashMap<String, String> implements ProxyObject
|
||||
String oVal = overrideEntry.getValue();
|
||||
if (oVal.toUpperCase().endsWith("UNDEF") || oVal.toUpperCase(Locale.ROOT).endsWith("UNSET")) {
|
||||
String removed = result.remove(oKey);
|
||||
logger.trace("Removed key '" + oKey + "': '" + removed + "' from script params because it was " + oVal + " in overrides");
|
||||
logger.trace(() -> "Removed key '" + oKey + "': '" + removed + "' from script params because it was " + oVal + " in overrides");
|
||||
} else {
|
||||
String was = result.get(oKey);
|
||||
was = (was == null ? "NULL" : was);
|
||||
@ -114,7 +114,7 @@ public class ScriptParams extends HashMap<String, String> implements ProxyObject
|
||||
}
|
||||
|
||||
private static void printMapToLog(String name, Map<String, String> map) {
|
||||
logger.info("contents of map '" + name + "':");
|
||||
logger.info(() -> "contents of map '" + name + "':");
|
||||
String mapdetail = map.entrySet()
|
||||
.stream()
|
||||
.map(e -> valueOf(e.getKey()) + ":" + valueOf(e.getValue()))
|
||||
|
@ -43,7 +43,7 @@ public class PolyglotMetricRegistryBindings implements ProxyObject, MetricRegist
|
||||
|
||||
@Override
|
||||
public Object getMember(String key) {
|
||||
logger.trace("get member: " + key);
|
||||
logger.trace(() -> "get member: " + key);
|
||||
Object o = metrics.get(key);
|
||||
return o;
|
||||
}
|
||||
|
@ -338,7 +338,7 @@ public class LoggerConfig extends ConfigurationFactory {
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (File file : toDelete) {
|
||||
logger.info("removing extra logfile: " + file.getPath());
|
||||
logger.info(() -> "removing extra logfile: " + file.getPath());
|
||||
if (!file.delete()) {
|
||||
logger.warn("unable to delete: " + file);
|
||||
try {
|
||||
|
@ -60,7 +60,7 @@ public class MetricMap implements ProxyObject {
|
||||
Object element = current.map.get(edgeName);
|
||||
if (element instanceof MetricMap) {
|
||||
current = (MetricMap) element;
|
||||
logger.trace("traversing edge:" + edgeName);
|
||||
logger.trace(() -> "traversing edge:" + edgeName);
|
||||
} else {
|
||||
String error = "edge exists at level:" + i;
|
||||
logger.error(error);
|
||||
@ -70,7 +70,7 @@ public class MetricMap implements ProxyObject {
|
||||
MetricMap newMap = new MetricMap(edgeName,this.name);
|
||||
current.map.put(edgeName, newMap);
|
||||
current = newMap;
|
||||
logger.trace("adding edge:" + edgeName);
|
||||
logger.trace(() -> "adding edge:" + edgeName);
|
||||
}
|
||||
}
|
||||
return current;
|
||||
|
@ -92,7 +92,7 @@ public class MetricReporters implements Shutdownable {
|
||||
|
||||
public MetricReporters addGraphite(String host, int graphitePort, String globalPrefix) {
|
||||
|
||||
logger.debug("Adding graphite reporter to " + host + " with port " + graphitePort + " and prefix " + globalPrefix);
|
||||
logger.debug(() -> "Adding graphite reporter to " + host + " with port " + graphitePort + " and prefix " + globalPrefix);
|
||||
|
||||
if (metricRegistries.isEmpty()) {
|
||||
throw new RuntimeException("There are no metric registries.");
|
||||
@ -137,7 +137,7 @@ public class MetricReporters implements Shutdownable {
|
||||
|
||||
public MetricReporters start(int consoleIntervalSeconds, int remoteIntervalSeconds) {
|
||||
for (ScheduledReporter scheduledReporter : scheduledReporters) {
|
||||
logger.info("starting reporter: " + scheduledReporter.getClass().getSimpleName());
|
||||
logger.info(() -> "starting reporter: " + scheduledReporter.getClass().getSimpleName());
|
||||
if (scheduledReporter instanceof ConsoleReporter) {
|
||||
scheduledReporter.start(consoleIntervalSeconds, TimeUnit.SECONDS);
|
||||
} else {
|
||||
@ -149,7 +149,7 @@ public class MetricReporters implements Shutdownable {
|
||||
|
||||
public MetricReporters stop() {
|
||||
for (ScheduledReporter scheduledReporter : scheduledReporters) {
|
||||
logger.info("stopping reporter: " + scheduledReporter);
|
||||
logger.info(() -> "stopping reporter: " + scheduledReporter);
|
||||
scheduledReporter.stop();
|
||||
}
|
||||
return this;
|
||||
@ -158,7 +158,7 @@ public class MetricReporters implements Shutdownable {
|
||||
|
||||
public MetricReporters report() {
|
||||
for (ScheduledReporter scheduledReporter : scheduledReporters) {
|
||||
logger.info("flushing reporter data: " + scheduledReporter);
|
||||
logger.info(() -> "flushing reporter data: " + scheduledReporter);
|
||||
scheduledReporter.report();
|
||||
}
|
||||
return this;
|
||||
|
@ -136,7 +136,7 @@ public class ActivityExecutorTest {
|
||||
for (int offset = 0; offset < speeds.length; offset += 2) {
|
||||
int threadTarget = speeds[offset];
|
||||
int threadTime = speeds[offset + 1];
|
||||
logger.info("Setting thread level to " + threadTarget + " for " + threadTime + " seconds.");
|
||||
logger.info(() -> "Setting thread level to " + threadTarget + " for " + threadTime + " seconds.");
|
||||
ad.setThreads(threadTarget);
|
||||
try {
|
||||
Thread.sleep(threadTime);
|
||||
@ -185,12 +185,12 @@ public class ActivityExecutorTest {
|
||||
@Override
|
||||
public void initActivity() {
|
||||
Integer initdelay = activityDef.getParams().getOptionalInteger("initdelay").orElse(0);
|
||||
logger.info("delaying for " + initdelay);
|
||||
logger.info(() -> "delaying for " + initdelay);
|
||||
try {
|
||||
Thread.sleep(initdelay);
|
||||
} catch (InterruptedException ignored) {
|
||||
}
|
||||
logger.info("delayed for " + initdelay);
|
||||
logger.info(() -> "delayed for " + initdelay);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class ScenarioTest {
|
||||
try {
|
||||
var result=scenario.call();
|
||||
} catch (Exception e) {
|
||||
logger.debug("Scenario run encountered an exception: " + e.getMessage());
|
||||
logger.debug(() -> "Scenario run encountered an exception: " + e.getMessage());
|
||||
|
||||
}
|
||||
assertThat(scenario.getIOLog().get().get(0)).contains("loaded script environment...");
|
||||
|
@ -33,6 +33,7 @@ import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
@ -61,14 +62,14 @@ public class DockerHelper {
|
||||
}
|
||||
|
||||
public String startDocker(String IMG, String tag, String name, List<Integer> ports, List<String> volumeDescList, List<String> envList, List<String> cmdList, String reload, List<String> linkNames) {
|
||||
logger.info("Starting docker with img=" + IMG + ", tag=" + tag + ", name=" + name + ", " +
|
||||
logger.info(() -> "Starting docker with img=" + IMG + ", tag=" + tag + ", name=" + name + ", " +
|
||||
"ports=" + ports + ", volumes=" + volumeDescList + ", env=" + envList + ", cmds=" + cmdList + ", reload=" + reload);
|
||||
|
||||
boolean existingContainer = removeExitedContainers(name);
|
||||
|
||||
Container containerId = searchContainer(name, reload, tag);
|
||||
if (containerId != null) {
|
||||
logger.debug("container is already up with the id: " + containerId.getId());
|
||||
logger.debug(() -> "container is already up with the id: " + containerId.getId());
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -139,13 +140,13 @@ public class DockerHelper {
|
||||
|
||||
private boolean startStoppedContainer(String name) {
|
||||
ListContainersCmd listContainersCmd = dockerClient.listContainersCmd().withStatusFilter(List.of("stopped"));
|
||||
listContainersCmd.getFilters().put("name", Arrays.asList(name));
|
||||
listContainersCmd.getFilters().put("name", Collections.singletonList(name));
|
||||
List<Container> stoppedContainers = null;
|
||||
try {
|
||||
stoppedContainers = listContainersCmd.exec();
|
||||
for (Container stoppedContainer : stoppedContainers) {
|
||||
String id = stoppedContainer.getId();
|
||||
logger.info("Removing exited container: " + id);
|
||||
logger.info(() -> "Removing exited container: " + id);
|
||||
dockerClient.removeContainerCmd(id).exec();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@ -161,13 +162,13 @@ public class DockerHelper {
|
||||
|
||||
private boolean removeExitedContainers(String name) {
|
||||
ListContainersCmd listContainersCmd = dockerClient.listContainersCmd().withStatusFilter(List.of("exited"));
|
||||
listContainersCmd.getFilters().put("name", Arrays.asList(name));
|
||||
listContainersCmd.getFilters().put("name", Collections.singletonList(name));
|
||||
List<Container> stoppedContainers = null;
|
||||
try {
|
||||
stoppedContainers = listContainersCmd.exec();
|
||||
for (Container stoppedContainer : stoppedContainers) {
|
||||
String id = stoppedContainer.getId();
|
||||
logger.info("Removing exited container: " + id);
|
||||
logger.info(() -> "Removing exited container: " + id);
|
||||
dockerClient.removeContainerCmd(id).exec();
|
||||
return true;
|
||||
}
|
||||
@ -184,7 +185,7 @@ public class DockerHelper {
|
||||
public Container searchContainer(String name, String reload, String tag) {
|
||||
|
||||
ListContainersCmd listContainersCmd = dockerClient.listContainersCmd().withStatusFilter(List.of("running"));
|
||||
listContainersCmd.getFilters().put("name", Arrays.asList(name));
|
||||
listContainersCmd.getFilters().put("name", Collections.singletonList(name));
|
||||
List<Container> runningContainers = null;
|
||||
try {
|
||||
runningContainers = listContainersCmd.exec();
|
||||
@ -196,9 +197,9 @@ public class DockerHelper {
|
||||
|
||||
if (runningContainers.size() >= 1) {
|
||||
//Container test = runningContainers.get(0);
|
||||
logger.info(String.format("The container %s is already running", name));
|
||||
logger.info(() -> String.format("The container %s is already running", name));
|
||||
|
||||
logger.info(String.format("Hupping config"));
|
||||
logger.info(() -> "Hupping config");
|
||||
|
||||
if (reload != null) {
|
||||
try {
|
||||
|
@ -47,7 +47,7 @@ public class RestHelper {
|
||||
content = contentSupplier.get();
|
||||
}
|
||||
|
||||
logger.debug("posting to " + url + ", auth: " + auth + " task:" + taskname);
|
||||
logger.debug(() -> "posting to " + url + ", auth: " + auth + " task:" + taskname);
|
||||
|
||||
HttpRequest.Builder builder = HttpRequest.newBuilder();
|
||||
builder = builder.uri(URI.create(url));
|
||||
@ -70,8 +70,8 @@ public class RestHelper {
|
||||
|
||||
try {
|
||||
HttpResponse<String> resp = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
|
||||
logger.debug("http response for configuring grafana:\n" + resp);
|
||||
logger.debug("response status code: " + resp.statusCode());
|
||||
logger.debug(() -> "http response for configuring grafana:\n" + resp);
|
||||
logger.debug(() -> "response status code: " + resp.statusCode());
|
||||
logger.debug("response body: " + resp.body());
|
||||
if (resp.statusCode()==412) {
|
||||
logger.warn("Unable to configure dashboard, grafana precondition failed (status 412): " + resp.body());
|
||||
|
@ -89,7 +89,7 @@ public class S3Uploader implements ScenarioMetadataAware {
|
||||
combined
|
||||
)
|
||||
.orElseThrow();
|
||||
logger.debug("S3 composite URL is '" + url + "'");
|
||||
logger.debug(() -> "S3 composite URL is '" + url + "'");
|
||||
|
||||
S3UrlFields fields = S3UrlFields.fromURLString(url);
|
||||
S3ClientCache s3ClientCache = new S3ClientCache();
|
||||
|
@ -37,7 +37,7 @@ public class ScriptingMetrics {
|
||||
public ScriptingGauge newGauge(String name, double initialValue) {
|
||||
ScriptingGauge scriptingGauge = new ScriptingGauge(name, initialValue);
|
||||
ActivityMetrics.gauge(scriptContext,name, scriptingGauge);
|
||||
logger.info("registered scripting gauge:" + name);
|
||||
logger.info(() -> "registered scripting gauge:" + name);
|
||||
return scriptingGauge;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class ShutdownHookPlugin {
|
||||
Thread runnable = new ShutdownRunnableFunction(logger, name, (Function<?,?>)f);
|
||||
runnable.setName(shutdownName);
|
||||
Runtime.getRuntime().addShutdownHook(runnable);
|
||||
logger.info("Registered shutdown hook to run under name '" + shutdownName + "'");
|
||||
logger.info(() -> "Registered shutdown hook to run under name '" + shutdownName + "'");
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -34,13 +34,13 @@ public class ShutdownRunnableFunction extends Thread {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
logger.info("Running shutdown hook '" + name + "'...");
|
||||
logger.info(() -> "Running shutdown hook '" + name + "'...");
|
||||
try {
|
||||
Object result = function.apply(new Object[0]);
|
||||
if (result instanceof CharSequence) {
|
||||
logger.info("shutdown hook returned output:\n" + result);
|
||||
logger.info(() -> "shutdown hook returned output:\n" + result);
|
||||
}
|
||||
logger.info("Completed shutdown hook '" + name + "'...");
|
||||
logger.info(() -> "Completed shutdown hook '" + name + "'...");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
@ -84,8 +84,8 @@ public class TestOptimoExperiments {
|
||||
);
|
||||
PointValuePair result = mo.optimize(od.toArray(new OptimizationData[0]));
|
||||
|
||||
logger.debug(
|
||||
"point:" + Arrays.toString(result.getPoint()) +
|
||||
logger.debug(() ->
|
||||
"point:" + Arrays.toString(result.getPoint()) +
|
||||
" value=" + m.value(result.getPoint())
|
||||
);
|
||||
|
||||
|
@ -143,7 +143,7 @@ public class WorkspaceFinder {
|
||||
"parameter that matches. This is a safety mechanism."
|
||||
);
|
||||
}
|
||||
logger.debug("found " + foundFiles + " to delete.");
|
||||
logger.debug(() -> "found " + foundFiles + " to delete.");
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
@ -158,7 +158,7 @@ public class WorkspaceFinder {
|
||||
.map(Path::toFile)
|
||||
// .peek(System.out::println)
|
||||
.forEach(f -> {
|
||||
logger.debug("deleting '" + f + "'");
|
||||
logger.debug(() -> "deleting '" + f + "'");
|
||||
if (!f.delete()) {
|
||||
throw new RuntimeException("Unable to delete " + f);
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class OpenApiLoader {
|
||||
yaml.setBeanAccess(BeanAccess.DEFAULT);
|
||||
|
||||
for (PathOp activeOp : activeOps) {
|
||||
logger.debug("yaml for op:" + yaml.dump(activeOp));
|
||||
logger.debug(() -> "yaml for op:" + yaml.dump(activeOp));
|
||||
pathops.put(activeOp.getCall(), activeOp);
|
||||
}
|
||||
|
||||
|
@ -47,7 +47,7 @@ public class DataSources {
|
||||
|
||||
src = NBIO.all().name(filename).first()
|
||||
.map(c -> {
|
||||
logger.debug("found 'data' at " + c.getURI());
|
||||
logger.debug(() -> "found 'data' at " + c.getURI());
|
||||
return c.asString();
|
||||
}).orElseThrow();
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public class Synonyms {
|
||||
}
|
||||
|
||||
public static String canonicalize(String arg, Logger logger) {
|
||||
return canonicalize(arg, PARAM_SYNONYMS, (d, p) -> logger.debug(
|
||||
return canonicalize(arg, PARAM_SYNONYMS, (d, p) -> logger.debug(() ->
|
||||
"rewrote synonym to canonical term (" + d +" => " + p +")"
|
||||
));
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class ConfigLoader {
|
||||
|
||||
data = NBIO.all().name(filename).first()
|
||||
.map(c -> {
|
||||
logger.debug("found 'data' at " + c.getURI());
|
||||
logger.debug(() -> "found 'data' at " + c.getURI());
|
||||
return c.asString();
|
||||
}).orElseThrow();
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public class PathFinder {
|
||||
}
|
||||
return Optional.empty();
|
||||
} catch (Exception e) {
|
||||
logger.trace("Error while looking in classpath for " + candidatePath, e);
|
||||
logger.trace(() -> "Error while looking in classpath for " + candidatePath, e);
|
||||
return Optional.empty();
|
||||
}
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ public class ParameterMap extends ConcurrentHashMap<String,Object> implements Bi
|
||||
private final LinkedList<Listener> listeners = new LinkedList<>();
|
||||
|
||||
public ParameterMap(Map<String, String> valueMap) {
|
||||
logger.trace("new parameter map:" + valueMap.toString());
|
||||
logger.trace(() -> "new parameter map:" + valueMap.toString());
|
||||
this.changeCounter=new AtomicLong(0L);
|
||||
putAll(valueMap);
|
||||
}
|
||||
@ -170,19 +170,19 @@ public class ParameterMap extends ConcurrentHashMap<String,Object> implements Bi
|
||||
|
||||
@Override
|
||||
public Object get(Object key) {
|
||||
logger.trace("getting parameter " + key);
|
||||
logger.trace(() -> "getting parameter " + key);
|
||||
return super.get(key);
|
||||
}
|
||||
|
||||
public void setSilently(String paramName, Object newValue) {
|
||||
super.put(paramName, String.valueOf(newValue));
|
||||
logger.trace("setting param silently " + paramName + "=" + newValue);
|
||||
logger.trace(() -> "setting param silently " + paramName + "=" + newValue);
|
||||
}
|
||||
|
||||
|
||||
public void set(String paramName, Object newValue) {
|
||||
super.put(paramName, String.valueOf(newValue));
|
||||
logger.info("setting param " + paramName + "=" + newValue);
|
||||
logger.info(() -> "setting param " + paramName + "=" + newValue);
|
||||
markMutation();
|
||||
}
|
||||
|
||||
@ -193,7 +193,7 @@ public class ParameterMap extends ConcurrentHashMap<String,Object> implements Bi
|
||||
@Override
|
||||
public Object put(String name, Object value) {
|
||||
Object oldVal = super.put(name, String.valueOf(value));
|
||||
logger.info("putting param " + name + "=" + value);
|
||||
logger.info(() -> "putting param " + name + "=" + value);
|
||||
|
||||
markMutation();
|
||||
return oldVal;
|
||||
@ -218,7 +218,7 @@ public class ParameterMap extends ConcurrentHashMap<String,Object> implements Bi
|
||||
@Override
|
||||
public Object remove(Object key) {
|
||||
Object removed = super.remove(key);
|
||||
logger.trace("removing param: " + key);
|
||||
logger.trace(() -> "removing param: " + key);
|
||||
|
||||
markMutation();
|
||||
return removed;
|
||||
@ -226,7 +226,7 @@ public class ParameterMap extends ConcurrentHashMap<String,Object> implements Bi
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
logger.debug("parameter map cleared:" + this);
|
||||
logger.debug(() -> "parameter map cleared:" + this);
|
||||
super.clear();
|
||||
|
||||
markMutation();
|
||||
@ -234,7 +234,7 @@ public class ParameterMap extends ConcurrentHashMap<String,Object> implements Bi
|
||||
|
||||
@Override
|
||||
public Set<Entry<String, Object>> entrySet() {
|
||||
logger.debug("getting entry set for " + this);
|
||||
logger.debug(() -> "getting entry set for " + this);
|
||||
return super.entrySet()
|
||||
.stream()
|
||||
.map(e -> new AbstractMap.SimpleEntry<String,Object>(e.getKey(), e.getValue()) {})
|
||||
@ -244,7 +244,7 @@ public class ParameterMap extends ConcurrentHashMap<String,Object> implements Bi
|
||||
|
||||
private void markMutation() {
|
||||
changeCounter.incrementAndGet();
|
||||
logger.trace("calling " + listeners.size() + " listeners.");
|
||||
logger.trace(() -> "calling " + listeners.size() + " listeners.");
|
||||
callListeners();
|
||||
}
|
||||
|
||||
@ -272,7 +272,7 @@ public class ParameterMap extends ConcurrentHashMap<String,Object> implements Bi
|
||||
|
||||
private void callListeners() {
|
||||
for (Listener listener : listeners) {
|
||||
logger.trace("calling listener:" + listener);
|
||||
logger.trace(() -> "calling listener:" + listener);
|
||||
listener.handleParameterMapUpdate(this);
|
||||
}
|
||||
}
|
||||
|
@ -91,7 +91,7 @@ public class ActivityMetrics {
|
||||
if (metric == null) {
|
||||
metric = metricProvider.getMetric();
|
||||
Metric registered = get().register(name, metric);
|
||||
logger.info("registered scripting metric: " + name);
|
||||
logger.info(() -> "registered scripting metric: " + name);
|
||||
return registered;
|
||||
}
|
||||
}
|
||||
@ -260,7 +260,7 @@ public class ActivityMetrics {
|
||||
|
||||
HistoIntervalLogger histoIntervalLogger =
|
||||
new HistoIntervalLogger(sessionName, logfile, compiledPattern, intervalMillis);
|
||||
logger.debug("attaching " + histoIntervalLogger + " to the metrics registry.");
|
||||
logger.debug(() -> "attaching " + histoIntervalLogger + " to the metrics registry.");
|
||||
get().addListener(histoIntervalLogger);
|
||||
metricsCloseables.add(histoIntervalLogger);
|
||||
}
|
||||
@ -283,7 +283,7 @@ public class ActivityMetrics {
|
||||
|
||||
HistoStatsLogger histoStatsLogger =
|
||||
new HistoStatsLogger(sessionName, logfile, compiledPattern, intervalMillis, TimeUnit.NANOSECONDS);
|
||||
logger.debug("attaching " + histoStatsLogger + " to the metrics registry.");
|
||||
logger.debug(() -> "attaching " + histoStatsLogger + " to the metrics registry.");
|
||||
get().addListener(histoStatsLogger);
|
||||
metricsCloseables.add(histoStatsLogger);
|
||||
}
|
||||
@ -304,12 +304,12 @@ public class ActivityMetrics {
|
||||
|
||||
ClassicHistoListener classicHistoListener =
|
||||
new ClassicHistoListener(get(), sessionName, prefix, compiledPattern, interval, TimeUnit.NANOSECONDS);
|
||||
logger.debug("attaching histo listener " + classicHistoListener + " to the metrics registry.");
|
||||
logger.debug(() -> "attaching histo listener " + classicHistoListener + " to the metrics registry.");
|
||||
get().addListener(classicHistoListener);
|
||||
|
||||
ClassicTimerListener classicTimerListener =
|
||||
new ClassicTimerListener(get(), sessionName, prefix, compiledPattern, interval, TimeUnit.NANOSECONDS);
|
||||
logger.debug("attaching timer listener " + classicTimerListener + " to the metrics registry.");
|
||||
logger.debug(() -> "attaching timer listener " + classicTimerListener + " to the metrics registry.");
|
||||
get().addListener(classicTimerListener);
|
||||
}
|
||||
|
||||
@ -322,7 +322,7 @@ public class ActivityMetrics {
|
||||
public static void closeMetrics(boolean showChart) {
|
||||
logger.trace("Closing all registered metrics closable objects.");
|
||||
for (MetricsCloseable metricsCloseable : metricsCloseables) {
|
||||
logger.trace("closing metrics closeable: " + metricsCloseable);
|
||||
logger.trace(() -> "closing metrics closeable: " + metricsCloseable);
|
||||
metricsCloseable.closeMetrics();
|
||||
if (showChart) {
|
||||
metricsCloseable.chart();
|
||||
|
@ -54,7 +54,7 @@ public class ClassicHistoListener extends CapabilityHook<HistogramAttachment> {
|
||||
|
||||
this.histos.put(prefixed, new Attachment(name, prefix, capable, classicHisto));
|
||||
metricsRegistry.histogram(prefixed, () -> classicHisto);
|
||||
logger.trace("Added classic histogram attachment:" + prefixed);
|
||||
logger.trace(() -> "Added classic histogram attachment:" + prefixed);
|
||||
}
|
||||
|
||||
}
|
||||
@ -62,7 +62,7 @@ public class ClassicHistoListener extends CapabilityHook<HistogramAttachment> {
|
||||
@Override
|
||||
public void onCapableRemoved(String name, HistogramAttachment capable) {
|
||||
Attachment removed = histos.remove(name);
|
||||
logger.trace("Removed classic histogram attachment: " + removed);
|
||||
logger.trace(() -> "Removed classic histogram attachment: " + removed);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -56,7 +56,7 @@ public class ClassicTimerListener extends CapabilityHook<TimerAttachment> {
|
||||
|
||||
this.histos.put(prefixed, new Attachment(name, prefix, capable, classicTimer));
|
||||
metricsRegistry.timer(prefixed, () -> classicTimer);
|
||||
logger.trace("Added classic timer attachment:" + prefixed);
|
||||
logger.trace(() -> "Added classic timer attachment:" + prefixed);
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ public class ClassicTimerListener extends CapabilityHook<TimerAttachment> {
|
||||
@Override
|
||||
public void onCapableRemoved(String name, TimerAttachment capable) {
|
||||
Attachment removed = histos.remove(name);
|
||||
logger.trace("Removed classic timer attachment: " + removed);
|
||||
logger.trace(() -> "Removed classic timer attachment: " + removed);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -91,9 +91,7 @@ public class HistoIntervalLogger extends CapabilityHook<HdrDeltaHistogramAttach
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("HistoLogger:" + this.pattern + ":" + this.logfile.getPath() + ":" + this.intervalLength);
|
||||
return sb.toString();
|
||||
return "HistoLogger:" + this.pattern + ":" + this.logfile.getPath() + ":" + this.intervalLength;
|
||||
}
|
||||
|
||||
public long getInterval() {
|
||||
@ -130,7 +128,7 @@ public class HistoIntervalLogger extends CapabilityHook<HdrDeltaHistogramAttach
|
||||
executor.close();
|
||||
long potentialWriteTime = System.currentTimeMillis();
|
||||
if (lastRunTime +1000 < potentialWriteTime) {
|
||||
logger.debug("Writing last partial histo log:" + this);
|
||||
logger.debug(() -> "Writing last partial histo log:" + this);
|
||||
run();
|
||||
} else {
|
||||
logger.debug("Not writing last partial histo log <1s:" + this);
|
||||
|
@ -70,7 +70,7 @@ public class PeriodicRunnable<T extends Runnable> implements Runnable, AutoClose
|
||||
long nextEventTime = System.currentTimeMillis() + intervalMillis;
|
||||
while (running) {
|
||||
nextEventTime = awaitTime(intervalMillis, nextEventTime);
|
||||
logger.trace("invoking interval runnable " + action);
|
||||
logger.trace(() -> "invoking interval runnable " + action);
|
||||
action.run();
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ public class BindingsTemplate {
|
||||
}
|
||||
|
||||
private void logAvailableDataMappers() {
|
||||
VirtDataDocs.getAllNames().forEach(gn -> logger.info("DATAMAPPER " + gn));
|
||||
VirtDataDocs.getAllNames().forEach(gn -> logger.info(() -> "DATAMAPPER " + gn));
|
||||
}
|
||||
|
||||
public List<String> getBindPointNames() {
|
||||
|
@ -49,7 +49,7 @@ public class DataMapperLibraryFinder {
|
||||
ServiceLoader<DataMapperLibrary> sl = ServiceLoader.load(DataMapperLibrary.class);
|
||||
Map<String,Integer> dups = new HashMap<>();
|
||||
for (DataMapperLibrary dataMapperLibrary : sl) {
|
||||
logger.debug("Found data mapper library:" +
|
||||
logger.debug(() -> "Found data mapper library:" +
|
||||
dataMapperLibrary.getClass().getCanonicalName() + ":" +
|
||||
dataMapperLibrary.getLibraryName());
|
||||
|
||||
@ -61,12 +61,12 @@ public class DataMapperLibraryFinder {
|
||||
libraries.put(dataMapperLibrary.getLibraryName(),dataMapperLibrary);
|
||||
}
|
||||
if (dups.size() > 0) {
|
||||
logger.trace("Java runtime provided duplicates for " +
|
||||
logger.trace(() -> "Java runtime provided duplicates for " +
|
||||
dups.entrySet().stream().map(e -> e.getKey()+":"+e.getValue()).collect(Collectors.joining(",")));
|
||||
}
|
||||
|
||||
}
|
||||
logger.info("Loaded DataMapper Libraries:" + libraries.keySet());
|
||||
logger.info(() -> "Loaded DataMapper Libraries:" + libraries.keySet());
|
||||
return libraries;
|
||||
}
|
||||
|
||||
|
@ -153,10 +153,10 @@ public class VirtData {
|
||||
return getOptionalMapper(flowSpec,clazz,Collections.emptyMap());
|
||||
}
|
||||
public static <T> Optional<DataMapper<T>> getOptionalMapper(
|
||||
String flowSpec,
|
||||
final String originalflowSpec,
|
||||
Class<?> clazz,
|
||||
Map<String,Object> config) {
|
||||
flowSpec = CompatibilityFixups.fixup(flowSpec);
|
||||
String flowSpec = CompatibilityFixups.fixup(originalflowSpec);
|
||||
VirtDataDSL.ParseResult parseResult = VirtDataDSL.parse(flowSpec);
|
||||
if (parseResult.throwable != null) {
|
||||
throw new RuntimeException(parseResult.throwable);
|
||||
@ -173,7 +173,7 @@ public class VirtData {
|
||||
" reliably be cast to type '" + clazz.getCanonicalName() +"'");
|
||||
}
|
||||
} else {
|
||||
logger.debug("Auto-assigning output type qualifier '->" + clazz.getCanonicalName() + "' to specifier '" + flowSpec + "'");
|
||||
logger.debug(() -> "Auto-assigning output type qualifier '->" + clazz.getCanonicalName() + "' to specifier '" + flowSpec + "'");
|
||||
flow.getLastExpression().getCall().setOutputType(clazz.getCanonicalName());
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ public class VirtDataComposer {
|
||||
List<ResolvedFunction> toRemove = new LinkedList<>();
|
||||
for (ResolvedFunction func : funcs) {
|
||||
if (!func.getInputClass().isAssignableFrom(long.class)) {
|
||||
logger.trace("input type " + func.getInputClass().getCanonicalName() + " is not assignable from long");
|
||||
logger.trace(() -> "input type " + func.getInputClass().getCanonicalName() + " is not assignable from long");
|
||||
toRemove.add(func);
|
||||
}
|
||||
}
|
||||
@ -286,9 +286,7 @@ public class VirtDataComposer {
|
||||
l -> l.stream().map(String::valueOf).collect(Collectors.joining("|\n"))
|
||||
).collect(Collectors.joining("\n\n"));
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append("---\\\\\n").append(funcsdata).append("\n---////\n");
|
||||
return sb.toString();
|
||||
return "---\\\\\n" + funcsdata + "\n---////\n";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -375,7 +373,7 @@ public class VirtDataComposer {
|
||||
progressed += funcs.size() - 1;
|
||||
funcs.sort(ResolvedFunction.PREFERRED_TYPE_COMPARATOR);
|
||||
while (funcs.size() > 1) {
|
||||
logger.trace("BY-SINGLE-PREFERRED-TYPE removing func " + funcs.get(funcs.size() - 1)
|
||||
logger.trace(() -> "BY-SINGLE-PREFERRED-TYPE removing func " + funcs.get(funcs.size() - 1)
|
||||
+ " because " + funcs.get(0) + " has more preferred types.");
|
||||
funcs.remove(funcs.size() - 1);
|
||||
}
|
||||
|
@ -157,11 +157,11 @@ public class VirtDataFunctionResolver {
|
||||
|
||||
if (targetCtor.isVarArgs()) {
|
||||
if (sourceParameters.length < (targetTypes.length - 1)) {
|
||||
logger.trace(targetCtor + " (varargs) does not match, not enough source parameters: " + Arrays.toString(sourceParameters));
|
||||
logger.trace(() -> targetCtor + " (varargs) does not match, not enough source parameters: " + Arrays.toString(sourceParameters));
|
||||
return false;
|
||||
}
|
||||
} else if (sourceParameters.length != targetTypes.length) {
|
||||
logger.trace(targetCtor + " (varargs) does not match source parameters (size): " + Arrays.toString(sourceParameters));
|
||||
logger.trace(() -> targetCtor + " (varargs) does not match source parameters (size): " + Arrays.toString(sourceParameters));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -42,7 +42,7 @@ public class FunctionAssemblerMatrixTest {
|
||||
funcs.addAll(Arrays.asList(objects));
|
||||
}
|
||||
|
||||
long totalIterations = funcs.size() * funcs.size();
|
||||
long totalIterations = (long) funcs.size() * funcs.size();
|
||||
|
||||
for (Object f1 : funcs) {
|
||||
// if (ft1 == FunctionType.R_T
|
||||
@ -70,7 +70,7 @@ public class FunctionAssemblerMatrixTest {
|
||||
|
||||
DataMapper g = DataMapperFunctionMapper.map(assy.getResolvedFunction().getFunctionObject());
|
||||
Object o = g.get(1L);
|
||||
logger.debug(" out:" + o);
|
||||
logger.debug(() -> " out:" + o);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ public class VirtDataDSL {
|
||||
parser.addParseListener(astListener);
|
||||
|
||||
VirtDataParser.VirtdataFlowContext virtdataFlowContext = parser.virtdataFlow();
|
||||
logger.trace("parse tree: " + virtdataFlowContext.toStringTree(parser));
|
||||
logger.trace(() -> "parse tree: " + virtdataFlowContext.toStringTree(parser));
|
||||
|
||||
if (astListener.hasErrors()) {
|
||||
System.out.println(astListener.getErrorNodes());
|
||||
|
@ -65,7 +65,7 @@ public class VirtdataBuilderTest {
|
||||
char[] chars = readFile("test-syntax.virtdata");
|
||||
CodePointCharStream ais = CharStreams.fromString(new String(chars));
|
||||
String inputString = new String(chars);
|
||||
logger.debug("Parsing:\n" + inputString);
|
||||
logger.debug(() -> "Parsing:\n" + inputString);
|
||||
VirtDataLexer lexer = new VirtDataLexer(ais);
|
||||
CommonTokenStream tokens = new CommonTokenStream(lexer);
|
||||
VirtDataParser parser = new VirtDataParser(tokens);
|
||||
@ -73,10 +73,10 @@ public class VirtdataBuilderTest {
|
||||
parser.addParseListener(astListener);
|
||||
|
||||
VirtDataParser.VirtdataRecipeContext virtdataRecipeContext = parser.virtdataRecipe();
|
||||
logger.debug(virtdataRecipeContext.toStringTree(parser));
|
||||
logger.debug(() -> virtdataRecipeContext.toStringTree(parser));
|
||||
|
||||
if (astListener.hasErrors()) {
|
||||
logger.debug(astListener.getErrorNodes());
|
||||
logger.debug(() -> astListener.getErrorNodes());
|
||||
}
|
||||
|
||||
VirtDataAST ast = astListener.getModel();
|
||||
|
@ -87,7 +87,7 @@ public class DirectoryLines implements LongFunction<String> {
|
||||
}
|
||||
|
||||
private List<Path> getAllFiles() {
|
||||
logger.debug("Loading file paths from " + basepath);
|
||||
logger.debug(() -> "Loading file paths from " + basepath);
|
||||
Set<FileVisitOption> options = new HashSet<>();
|
||||
options.add(FileVisitOption.FOLLOW_LINKS);
|
||||
FileList fileList = new FileList(namePattern);
|
||||
@ -97,7 +97,7 @@ public class DirectoryLines implements LongFunction<String> {
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
logger.debug("File reader: " + fileList + " in path: " + Paths.get(basepath).getFileName());
|
||||
logger.debug(() -> "File reader: " + fileList + " in path: " + Paths.get(basepath).getFileName());
|
||||
fileList.paths.sort(Path::compareTo);
|
||||
return fileList.paths;
|
||||
}
|
||||
|
@ -39,9 +39,9 @@ public class DiscreteProbabilityBufferTest {
|
||||
dp.normalize();
|
||||
|
||||
for (DiscreteProbabilityBuffer.Entry entry : dp) {
|
||||
logger.debug("entry: " + entry.getEventId() + ":" + entry.getProbability());
|
||||
logger.debug(() -> "entry: " + entry.getEventId() + ":" + entry.getProbability());
|
||||
}
|
||||
logger.debug("cumuProb:" + dp.getCumulativeProbability());
|
||||
logger.debug(() -> "cumuProb:" + dp.getCumulativeProbability());
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user