File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
test/jdk/com/sun/net/httpserver Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -110,7 +110,24 @@ public static void main (String[] args) throws Exception {
110110 if (s2 != null ) {
111111 s2 .stop (0 );
112112 }
113- executor .close ();
113+ boolean terminated = executor .isTerminated ();
114+ if (!terminated ) {
115+ executor .shutdown ();
116+ boolean interrupted = false ;
117+ while (!terminated ) {
118+ try {
119+ terminated = executor .awaitTermination (1L , TimeUnit .DAYS );
120+ } catch (InterruptedException e ) {
121+ if (!interrupted ) {
122+ executor .shutdownNow ();
123+ interrupted = true ;
124+ }
125+ }
126+ }
127+ if (interrupted ) {
128+ Thread .currentThread ().interrupt ();
129+ }
130+ }
114131 // it's OK to delete these files since the server side handlers
115132 // serving these files have completed (guaranteed by the completion of Executor.close())
116133 System .out .println ("deleting " + smallFilePath );
You can’t perform that action at this time.
0 commit comments