mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-01-11 00:12:04 -06:00
fix false positive on ungraceful shutdown warning
This commit is contained in:
parent
7b9f4389b8
commit
0668d1db0c
@ -421,7 +421,7 @@ public class ActivityExecutor implements NBLabeledElement, ActivityController, P
|
||||
activity.shutdownActivity();
|
||||
activity.closeAutoCloseables();
|
||||
ExecutionResult result = new ExecutionResult(startedAt, stoppedAt, "", exception);
|
||||
finish();
|
||||
finish(true);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@ -548,11 +548,15 @@ public class ActivityExecutor implements NBLabeledElement, ActivityController, P
|
||||
return activity.getLabels();
|
||||
}
|
||||
|
||||
public synchronized void finish() {
|
||||
if (shutdownHook!=null) {
|
||||
logger.warn("Activity was interrupted by process exit, shutting down");
|
||||
public synchronized void finish(boolean graceful) {
|
||||
if (graceful) {
|
||||
Runtime.getRuntime().removeShutdownHook(shutdownHook);
|
||||
} else {
|
||||
logger.warn("Activity was interrupted by process exit, shutting down ungracefully. Annotations are still submitted.");
|
||||
}
|
||||
shutdownHook=null;
|
||||
if (shutdownHook==null) return; // In case of a race condition, only prevented by object monitor
|
||||
else shutdownHook=null;
|
||||
|
||||
stoppedAt = System.currentTimeMillis(); //TODO: Make only one endedAtMillis assignment
|
||||
|
||||
Annotators.recordAnnotation(Annotation.newBuilder()
|
||||
|
@ -25,7 +25,7 @@ public class ActivityExecutorShutdownHook extends Thread {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
activityExecutor.finish();
|
||||
activityExecutor.finish(false);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user