equal
deleted
inserted
replaced
687 MBeanServerFactory.class.getName(), "getMBeanInfo", |
687 MBeanServerFactory.class.getName(), "getMBeanInfo", |
688 "Building MBeanInfo for " + |
688 "Building MBeanInfo for " + |
689 getImplementationClass().getName()); |
689 getImplementationClass().getName()); |
690 } |
690 } |
691 |
691 |
692 MBeanSupport msupport = mbean; |
692 MBeanSupport<?> msupport = mbean; |
693 final MBeanInfo bi = msupport.getMBeanInfo(); |
693 final MBeanInfo bi = msupport.getMBeanInfo(); |
694 final Object impl = msupport.getWrappedObject(); |
694 final Object impl = msupport.getWrappedObject(); |
695 |
695 |
696 final boolean immutableInfo = immutableInfo(this.getClass()); |
696 final boolean immutableInfo = immutableInfo(this.getClass()); |
697 |
697 |
1389 * Cached results of previous calls to immutableInfo. This is |
1389 * Cached results of previous calls to immutableInfo. This is |
1390 * a WeakHashMap so that we don't prevent a class from being |
1390 * a WeakHashMap so that we don't prevent a class from being |
1391 * garbage collected just because we know whether its MBeanInfo |
1391 * garbage collected just because we know whether its MBeanInfo |
1392 * is immutable. |
1392 * is immutable. |
1393 */ |
1393 */ |
1394 private static final Map<Class, Boolean> mbeanInfoSafeMap = |
1394 private static final Map<Class<?>, Boolean> mbeanInfoSafeMap = |
1395 new WeakHashMap<Class, Boolean>(); |
1395 new WeakHashMap<Class<?>, Boolean>(); |
1396 |
1396 |
1397 /** |
1397 /** |
1398 * Return true if {@code subclass} is known to preserve the immutability |
1398 * Return true if {@code subclass} is known to preserve the immutability |
1399 * of the {@code MBeanInfo}. The {@code subclass} is considered to have |
1399 * of the {@code MBeanInfo}. The {@code subclass} is considered to have |
1400 * an immutable {@code MBeanInfo} if it does not override any of the |
1400 * an immutable {@code MBeanInfo} if it does not override any of the |
1436 } |
1436 } |
1437 |
1437 |
1438 private static class MBeanInfoSafeAction |
1438 private static class MBeanInfoSafeAction |
1439 implements PrivilegedAction<Boolean> { |
1439 implements PrivilegedAction<Boolean> { |
1440 |
1440 |
1441 private final Class subclass; |
1441 private final Class<?> subclass; |
1442 |
1442 |
1443 MBeanInfoSafeAction(Class subclass) { |
1443 MBeanInfoSafeAction(Class<?> subclass) { |
1444 this.subclass = subclass; |
1444 this.subclass = subclass; |
1445 } |
1445 } |
1446 |
1446 |
1447 public Boolean run() { |
1447 public Boolean run() { |
1448 // Check for "void cacheMBeanInfo(MBeanInfo)" method. |
1448 // Check for "void cacheMBeanInfo(MBeanInfo)" method. |
1452 return false; |
1452 return false; |
1453 |
1453 |
1454 // Check for "MBeanInfo getCachedMBeanInfo()" method. |
1454 // Check for "MBeanInfo getCachedMBeanInfo()" method. |
1455 // |
1455 // |
1456 if (overrides(subclass, StandardMBean.class, |
1456 if (overrides(subclass, StandardMBean.class, |
1457 "getCachedMBeanInfo", (Class[]) null)) |
1457 "getCachedMBeanInfo", (Class<?>[]) null)) |
1458 return false; |
1458 return false; |
1459 |
1459 |
1460 // Check for "MBeanInfo getMBeanInfo()" method. |
1460 // Check for "MBeanInfo getMBeanInfo()" method. |
1461 // |
1461 // |
1462 if (overrides(subclass, StandardMBean.class, |
1462 if (overrides(subclass, StandardMBean.class, |
1463 "getMBeanInfo", (Class[]) null)) |
1463 "getMBeanInfo", (Class<?>[]) null)) |
1464 return false; |
1464 return false; |
1465 |
1465 |
1466 // Check for "MBeanNotificationInfo[] getNotificationInfo()" |
1466 // Check for "MBeanNotificationInfo[] getNotificationInfo()" |
1467 // method. |
1467 // method. |
1468 // |
1468 // |
1471 // StandardEmitterMBean itself or can be assigned to |
1471 // StandardEmitterMBean itself or can be assigned to |
1472 // StandardEmitterMBean. |
1472 // StandardEmitterMBean. |
1473 // |
1473 // |
1474 if (StandardEmitterMBean.class.isAssignableFrom(subclass)) |
1474 if (StandardEmitterMBean.class.isAssignableFrom(subclass)) |
1475 if (overrides(subclass, StandardEmitterMBean.class, |
1475 if (overrides(subclass, StandardEmitterMBean.class, |
1476 "getNotificationInfo", (Class[]) null)) |
1476 "getNotificationInfo", (Class<?>[]) null)) |
1477 return false; |
1477 return false; |
1478 return true; |
1478 return true; |
1479 } |
1479 } |
1480 } |
1480 } |
1481 } |
1481 } |