@@ -113,7 +113,6 @@ private static void completeInitialization() {
113113 if (Boolean .getBoolean ("ibm.java9.forceCommonCleanerShutdown" )) { //$NON-NLS-1$
114114 Runnable runnable = () -> {
115115 Thread [] threads ;
116- /*[IF JAVA_SPEC_VERSION < 19]*/
117116 ThreadGroup threadGroup ;
118117 try {
119118 Field innocuousThreadGroupField = InnocuousThread .class .getDeclaredField ("INNOCUOUSTHREADGROUP" ); //$NON-NLS-1$
@@ -123,16 +122,18 @@ private static void completeInitialization() {
123122 throw new InternalError (e );
124123 }
125124
126- threads = new Thread [threadGroup .numThreads ];
125+ threads = new Thread [threadGroup .activeCount () ];
127126 threadGroup .enumerate (threads , false );
128- /*[ELSE] JAVA_SPEC_VERSION < 19 */
129- threads = Thread .getAllThreads ();
130- /*[ENDIF] JAVA_SPEC_VERSION < 19 */
131127
132128 CleanerShutdown .shutdownCleaner ();
133129
134130 for (Thread t : threads ) {
135- if (t .getName ().equals ("Common-Cleaner" )) { //$NON-NLS-1$
131+ String threadName = t .getName ();
132+ if (threadName .equals ("Common-Cleaner" ) //$NON-NLS-1$
133+ /*[IF JAVA_SPEC_VERSION >= 26]*/
134+ || threadName .equals ("BufferCleaner" ) //$NON-NLS-1$
135+ /*[ENDIF] JAVA_SPEC_VERSION >= 26 */
136+ ) {
136137 t .interrupt ();
137138 try {
138139 /* Need to wait for the Common-Cleaner thread to die before
@@ -150,7 +151,6 @@ private static void completeInitialization() {
150151 } catch (Throwable e ) {
151152 /* empty block */
152153 }
153- break ;
154154 }
155155 }
156156 };
0 commit comments