stdout activity should not close stdout fd

This commit is contained in:
Jonathan Shook 2020-08-07 14:48:23 -05:00
parent 45e77f8db8
commit 637fbba985
2 changed files with 41 additions and 41 deletions

View File

@ -17,18 +17,16 @@
package io.nosqlbench.activitytype.stdout;
import io.nosqlbench.engine.api.activityconfig.ParsedStmt;
import io.nosqlbench.engine.api.activityconfig.StatementsLoader;
import io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate;
import io.nosqlbench.engine.api.activityconfig.yaml.StmtDef;
import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDoc;
import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList;
import com.codahale.metrics.Histogram;
import com.codahale.metrics.Timer;
import io.nosqlbench.engine.api.activityapi.core.ActivityDefObserver;
import io.nosqlbench.engine.api.activityapi.planning.OpSequence;
import io.nosqlbench.engine.api.activityapi.planning.SequencePlanner;
import io.nosqlbench.engine.api.activityapi.planning.SequencerType;
import io.nosqlbench.engine.api.activityconfig.ParsedStmt;
import io.nosqlbench.engine.api.activityconfig.StatementsLoader;
import io.nosqlbench.engine.api.activityconfig.yaml.OpTemplate;
import io.nosqlbench.engine.api.activityconfig.yaml.StmtsDocList;
import io.nosqlbench.engine.api.activityimpl.ActivityDef;
import io.nosqlbench.engine.api.activityimpl.ParameterMap;
import io.nosqlbench.engine.api.activityimpl.SimpleActivity;
@ -47,7 +45,6 @@ import java.io.Writer;
import java.util.*;
import java.util.function.Function;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
@SuppressWarnings("Duplicates")
public class StdoutActivity extends SimpleActivity implements ActivityDefObserver {
@ -84,8 +81,11 @@ public class StdoutActivity extends SimpleActivity implements ActivityDefObserve
public void shutdownActivity() {
try {
if (pw != null) {
if (!fileName.toLowerCase().equals("stdout")) {
logger.trace("Closing non-stdout output stream.");
pw.close();
}
}
} catch (Exception e) {
logger.warn("error closing writer:" + e, e);
}

View File

@ -251,7 +251,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
activitylogger.debug("AWAIT-FINISH/exception alias=(" + activity.getAlias() + ")");
throw stoppingException;
}
activitylogger.debug("AWAIT-FINISH/afte alias=(" + activity.getAlias() + ")");
activitylogger.debug("AWAIT-FINISH/after alias=(" + activity.getAlias() + ")");
return awaited;
}
@ -365,7 +365,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
long startedAt = System.currentTimeMillis();
while (System.currentTimeMillis() < (startedAt + waitTime)) {
Map<RunState,Integer> actualStates = new HashMap<>();
Map<RunState, Integer> actualStates = new HashMap<>();
for (RunState state : desiredRunStates) {
actualStates.compute(state, (k, v) -> (v == null ? 0 : v) + 1);
}
@ -373,7 +373,7 @@ public class ActivityExecutor implements ActivityController, ParameterMap.Listen
actualStates.remove(desiredRunState);
}
logger.trace("state of remaining slots:" + actualStates.toString());
if (actualStates.size()==0) {
if (actualStates.size() == 0) {
return true;
} else {
System.out.println("motor states:" + actualStates.toString());