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:
@@ -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);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user