Skip to content

Commit

Permalink
Remove shutdown hook register on supplied Launch
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Mar 5, 2024
1 parent 435fc8c commit 598d063
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public ReportPortalHook() {

public ReportPortalHook(Supplier<Launch> launchSupplier) {
launch = new MemoizingSupplier<>(launchSupplier);
shutDownHook = registerShutdownHook(this::finishLaunch);
}

/**
Expand Down Expand Up @@ -120,7 +119,7 @@ public void finishLaunch() {
System.getProperty("rp.launch.id")
);
launchObject.finish(rq);
if (Thread.currentThread() != shutDownHook) {
if (shutDownHook != null && Thread.currentThread() != shutDownHook) {
unregisterShutdownHook(shutDownHook);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ public ReportPortalPublisher(ReportPortal reportPortal) {

public ReportPortalPublisher(Supplier<Launch> launchSupplier) {
launch = new MemoizingSupplier<>(launchSupplier);
shutDownHook = registerShutdownHook(this::finishLaunch);
}

/**
Expand Down Expand Up @@ -114,7 +113,7 @@ public void finishLaunch() {
System.getProperty("rp.launch.id")
);
launchObject.finish(rq);
if (Thread.currentThread() != shutDownHook) {
if (shutDownHook != null && Thread.currentThread() != shutDownHook) {
unregisterShutdownHook(shutDownHook);
}
}
Expand Down

0 comments on commit 598d063

Please sign in to comment.