< prev index next >

src/jdk.internal.vm.compiler.management/share/classes/org.graalvm.compiler.hotspot.management/src/org/graalvm/compiler/hotspot/management/HotSpotGraalManagement.java

Print this page
rev 52509 : [mq]: graal


 133                     synchronized (this) {
 134                         // Wait until there are deferred registrations to process
 135                         while (deferred == null) {
 136                             wait();
 137                         }
 138                     }
 139                     poll();
 140                     Thread.sleep(POLL_INTERVAL_MS);
 141                 } catch (InterruptedException e) {
 142                     // Be verbose about unexpected interruption and then continue
 143                     e.printStackTrace(TTY.out);
 144                 }
 145             }
 146         }
 147 
 148         /**
 149          * Checks for active MBean server and if available, processes deferred registrations.
 150          */
 151         synchronized void poll() {
 152             if (platformMBeanServer == null) {

 153                 ArrayList<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null);
 154                 if (!servers.isEmpty()) {
 155                     platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
 156                     process();





 157                 }
 158             } else {
 159                 process();
 160             }
 161         }
 162     }
 163 
 164     private static final RegistrationThread registration = new RegistrationThread();
 165 
 166     @Override
 167     public ObjectName poll(boolean sync) {
 168         if (sync) {
 169             registration.poll();
 170         }
 171         if (bean == null || needsRegistration) {
 172             // initialize() has not been called, it failed or registration failed
 173             return null;
 174         }
 175         return bean.getObjectName();
 176     }


 133                     synchronized (this) {
 134                         // Wait until there are deferred registrations to process
 135                         while (deferred == null) {
 136                             wait();
 137                         }
 138                     }
 139                     poll();
 140                     Thread.sleep(POLL_INTERVAL_MS);
 141                 } catch (InterruptedException e) {
 142                     // Be verbose about unexpected interruption and then continue
 143                     e.printStackTrace(TTY.out);
 144                 }
 145             }
 146         }
 147 
 148         /**
 149          * Checks for active MBean server and if available, processes deferred registrations.
 150          */
 151         synchronized void poll() {
 152             if (platformMBeanServer == null) {
 153                 try {
 154                     ArrayList<MBeanServer> servers = MBeanServerFactory.findMBeanServer(null);
 155                     if (!servers.isEmpty()) {
 156                         platformMBeanServer = ManagementFactory.getPlatformMBeanServer();
 157                         process();
 158                     }
 159                 } catch (SecurityException e) {
 160                     // Without permission to find or create the MBeanServer,
 161                     // we cannot process any Graal mbeans.
 162                     deferred = null;
 163                 }
 164             } else {
 165                 process();
 166             }
 167         }
 168     }
 169 
 170     private static final RegistrationThread registration = new RegistrationThread();
 171 
 172     @Override
 173     public ObjectName poll(boolean sync) {
 174         if (sync) {
 175             registration.poll();
 176         }
 177         if (bean == null || needsRegistration) {
 178             // initialize() has not been called, it failed or registration failed
 179             return null;
 180         }
 181         return bean.getObjectName();
 182     }
< prev index next >