Skip to content

Commit

Permalink
Merge pull request wocommunity#1017 from maiksd/master
Browse files Browse the repository at this point in the history
Log names of unfinished shutdown hooks
  • Loading branch information
maiksd authored Apr 3, 2024
2 parents c0af44e + d1703b2 commit 11e2f35
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

import java.util.HashSet;
import java.util.Set;
import java.util.stream.Collectors;

import com.webobjects.foundation.NSKeyValueCoding;
import com.webobjects.foundation.NSNotification;
Expand Down Expand Up @@ -57,7 +58,8 @@ public void run() {
synchronized( ALL_HOOKS ) {
while( ALL_HOOKS.size() > 0 ) {
// Use System.out to minimize dependencies
System.out.println( "ShutdownHook waiting for " + ALL_HOOKS.size() + " hook" + (ALL_HOOKS.size() > 1 ? "s" : "") + " to complete" );
String names = ALL_HOOKS.stream().map( hook -> hook.name ).collect( Collectors.joining( ", " ) );
System.out.println( "ERXShutdownHook waiting for " + ALL_HOOKS.size() + " hook" + (ALL_HOOKS.size() > 1 ? "s" : "") + " to complete: " + names );
ALL_HOOKS.wait();
}

Expand All @@ -74,7 +76,7 @@ public void run() {
} );
}

private String name;
String name;

/**
* Call this in your app constructor if you have no other shutdown hooks. If you don't call
Expand Down

0 comments on commit 11e2f35

Please sign in to comment.