File tree Expand file tree Collapse file tree 1 file changed +24
-1
lines changed
test/jdk/java/net/httpclient Expand file tree Collapse file tree 1 file changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -181,7 +181,30 @@ public static void main(String[] args) throws Exception {
181181 checkReturn (requests );
182182
183183 // shuts down the executor and awaits its termination
184- executor .close ();
184+ //executor.close();
185+ // In 17, ExecutorService does not implement close().
186+ // I derived this from the implementation of the method
187+ // in 21.
188+ {
189+ boolean terminated = executor .isTerminated ();
190+ if (!terminated ) {
191+ executor .shutdown ();
192+ boolean interrupted = false ;
193+ while (!terminated ) {
194+ try {
195+ terminated = executor .awaitTermination (1L , TimeUnit .DAYS );
196+ } catch (InterruptedException e ) {
197+ if (!interrupted ) {
198+ executor .shutdownNow ();
199+ interrupted = true ;
200+ }
201+ }
202+ }
203+ if (interrupted ) {
204+ Thread .currentThread ().interrupt ();
205+ }
206+ }
207+ }
185208
186209 if (error )
187210 throw new RuntimeException ("Failed. Check output" );
You can’t perform that action at this time.
0 commit comments