mirror of
https://github.com/nosqlbench/nosqlbench.git
synced 2025-02-25 18:55:28 -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.shutdownActivity();
|
||||||
activity.closeAutoCloseables();
|
activity.closeAutoCloseables();
|
||||||
ExecutionResult result = new ExecutionResult(startedAt, stoppedAt, "", exception);
|
ExecutionResult result = new ExecutionResult(startedAt, stoppedAt, "", exception);
|
||||||
finish();
|
finish(true);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -548,11 +548,15 @@ public class ActivityExecutor implements NBLabeledElement, ActivityController, P
|
|||||||
return activity.getLabels();
|
return activity.getLabels();
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void finish() {
|
public synchronized void finish(boolean graceful) {
|
||||||
if (shutdownHook!=null) {
|
if (graceful) {
|
||||||
logger.warn("Activity was interrupted by process exit, shutting down");
|
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
|
stoppedAt = System.currentTimeMillis(); //TODO: Make only one endedAtMillis assignment
|
||||||
|
|
||||||
Annotators.recordAnnotation(Annotation.newBuilder()
|
Annotators.recordAnnotation(Annotation.newBuilder()
|
||||||
|
@ -25,7 +25,7 @@ public class ActivityExecutorShutdownHook extends Thread {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
activityExecutor.finish();
|
activityExecutor.finish(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user