< prev index next >

src/java.management/share/classes/com/sun/jmx/remote/internal/ClientNotifForwarder.java

Print this page

        

@@ -533,34 +533,35 @@
                 }
             }
 
             synchronized (ClientNotifForwarder.this) {
                 currentFetchThread = null;
+                if (nr != null && !shouldStop()) {
+                    executor.execute(this);
+                    return;
+                }
             }
 
             if (nr == null) {
                 if (logger.traceOn()) {
                     logger.trace("NotifFetcher-run",
                             "Recieved null object as notifs, stops fetching because the "
                                     + "notification server is terminated.");
                 }
             }
-            if (nr == null || shouldStop()) {
-                // tell that the thread is REALLY stopped
-                setState(STOPPED);
 
                 try {
                       removeListenerForMBeanRemovedNotif(mbeanRemovedNotifID);
                 } catch (Exception e) {
                     if (logger.traceOn()) {
                         logger.trace("NotifFetcher-run",
                                 "removeListenerForMBeanRemovedNotif", e);
                     }
                 }
-            } else {
-                executor.execute(this);
-            }
+            
+            // tell that the thread is REALLY stopped
+            setState(STOPPED);
         }
 
         void dispatchNotification(TargetedNotification tn,
                                   Integer myListenerID,
                                   Map<Integer, ClientListenerInfo> listeners) {
< prev index next >