Skip to content

Commit 9723edb

Browse files
Daniel IancuJoscorbe
authored andcommitted
OAK-11564 oak-run FullGC leaves background threads running
1 parent fc14e20 commit 9723edb

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

oak-run/src/main/java/org/apache/jackrabbit/oak/run/RevisionsCommand.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,20 @@ public class RevisionsCommand implements Command {
105105
"org.apache.jackrabbit.oak.plugins.document.VersionGCRecommendations"
106106
);
107107

108+
private final boolean exitWhenDone;
109+
110+
public RevisionsCommand() {
111+
this(true);
112+
}
113+
114+
/**
115+
*
116+
* @param exitWhenDone if true, the command will exit the JVM when done
117+
*/
118+
public RevisionsCommand(boolean exitWhenDone) {
119+
this.exitWhenDone = exitWhenDone;
120+
}
121+
108122
private static class RevisionsOptions extends Utils.NodeStoreOptions {
109123

110124
static final String CMD_INFO = "info";
@@ -325,6 +339,10 @@ public void execute(String... args) throws Exception {
325339
} else {
326340
System.err.println("unknown revisions command: " + subCmd);
327341
}
342+
if (exitWhenDone) {
343+
System.out.printf("Command '%s' completed successfully.%n", subCmd);
344+
System.exit(0);
345+
}
328346
} catch (Throwable e) {
329347
LOG.error("Command failed", e);
330348
throw closer.rethrow(e);

oak-run/src/test/java/org/apache/jackrabbit/oak/plugins/document/RevisionsCommandTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,7 +433,7 @@ public RevisionsCmd(String... args) {
433433
@Override
434434
public void run() {
435435
try {
436-
new RevisionsCommand().execute(args.toArray(new String[0]));
436+
new RevisionsCommand(false).execute(args.toArray(new String[0]));
437437
} catch (Exception e) {
438438
throw new RuntimeException(e);
439439
}

0 commit comments

Comments
 (0)