@@ -113,22 +113,6 @@ public void addCallbackOnExitExceptionHandler(Class<?> c, CallbackOnExitHandler
113
113
public void handleThrowable (Thread thread , Throwable t ) {
114
114
handlePossibleOOME (t );
115
115
116
- if (isThreadGroupDestroyed (thread , t )) {
117
- logger .warn ("Ignoring an attempt to start a JMX thread during shutdown." , t );
118
- return ;
119
- }
120
-
121
- if (isJMXTerminatedException (t )) {
122
- logger .warn ("Ignoring a Thread Service termination error from JMX." , t );
123
- return ;
124
- }
125
-
126
- if (isNotificationFetcherThread (thread )) {
127
- // DEV-5006 -- Do not exit L2.
128
- logger .warn ("Got Exception in JMX Notification forwarding" , t );
129
- return ;
130
- }
131
-
132
116
final CallbackOnExitState throwableState = new CallbackOnExitState (t );
133
117
scheduleExit (throwableState );
134
118
@@ -151,19 +135,6 @@ public void handleThrowable(Thread thread, Throwable t) {
151
135
exit (throwableState );
152
136
}
153
137
154
- private static boolean isThreadGroupDestroyed (Thread thread , Throwable t ) {
155
- // see EHCTERR-32
156
- if (t instanceof IllegalThreadStateException ) {
157
- StackTraceElement [] stack = t .getStackTrace ();
158
- StackTraceElement bottom = stack [stack .length - 1 ];
159
- if (stack [0 ].getClassName ().equals ("java.lang.ThreadGroup" ) && stack [0 ].getMethodName ().equals ("addUnstarted" )
160
- && bottom .getClassName ().equals ("javax.management.remote.generic.GenericConnectorServer$Receiver" )
161
- && bottom .getMethodName ().equals ("run" )) { return true ; }
162
- }
163
-
164
- return false ;
165
- }
166
-
167
138
/**
168
139
* Makes sure we don't allocate any heap objects on OOME.
169
140
* {@code -XX:+HeapDumpOnOutOfMemoryError} should take care of debug information.
@@ -241,26 +212,4 @@ protected synchronized void exit(int status) {
241
212
ThreadUtil .reallySleep (2000 );
242
213
System .exit (status );
243
214
}
244
-
245
- private static boolean isNotificationFetcherThread (Thread thread ) {
246
- // UGLY Way to Ignore exception in JMX Notification Forwarder Thread.
247
- try {
248
- Field runnableField = thread .getClass ().getDeclaredField ("target" );
249
- runnableField .setAccessible (true );
250
- Object runnable = runnableField .get (thread );
251
- if (runnable != null && runnable .getClass ().getSimpleName ().equals ("NotifFetcher" )) {
252
- return true ;
253
- } else {
254
- return false ;
255
- }
256
- } catch (Throwable e ) {
257
- return false ;
258
- }
259
-
260
- }
261
-
262
- private static boolean isJMXTerminatedException (Throwable throwable ) {
263
- return throwable instanceof IllegalStateException &&
264
- throwable .getMessage ().contains ("The Thread Service has been terminated." );
265
- }
266
215
}
0 commit comments