src/share/classes/sun/management/MemoryNotifInfoCompositeData.java

Print this page
rev 10195 : 8048267: Replace uses of 'new Long()' with appropriate alternative across core classes
Reviewed-by: chegar, psandoz
Contributed-by: otaviojava@java.net


  43     private MemoryNotifInfoCompositeData(MemoryNotificationInfo info) {
  44         this.memoryNotifInfo = info;
  45     }
  46 
  47     public MemoryNotificationInfo getMemoryNotifInfo() {
  48         return memoryNotifInfo;
  49     }
  50 
  51     public static CompositeData toCompositeData(MemoryNotificationInfo info) {
  52         MemoryNotifInfoCompositeData mnicd =
  53             new MemoryNotifInfoCompositeData(info);
  54         return mnicd.getCompositeData();
  55     }
  56 
  57     protected CompositeData getCompositeData() {
  58         // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
  59         // memoryNotifInfoItemNames!
  60         final Object[] memoryNotifInfoItemValues = {
  61             memoryNotifInfo.getPoolName(),
  62             MemoryUsageCompositeData.toCompositeData(memoryNotifInfo.getUsage()),
  63             new Long(memoryNotifInfo.getCount()),
  64         };
  65 
  66         try {
  67             return new CompositeDataSupport(memoryNotifInfoCompositeType,
  68                                             memoryNotifInfoItemNames,
  69                                             memoryNotifInfoItemValues);
  70         } catch (OpenDataException e) {
  71             // Should never reach here
  72             throw new AssertionError(e);
  73         }
  74     }
  75 
  76     private static final CompositeType memoryNotifInfoCompositeType;
  77     static {
  78         try {
  79             memoryNotifInfoCompositeType = (CompositeType)
  80                 MappedMXBeanType.toOpenType(MemoryNotificationInfo.class);
  81         } catch (OpenDataException e) {
  82             // Should never reach here
  83             throw new AssertionError(e);




  43     private MemoryNotifInfoCompositeData(MemoryNotificationInfo info) {
  44         this.memoryNotifInfo = info;
  45     }
  46 
  47     public MemoryNotificationInfo getMemoryNotifInfo() {
  48         return memoryNotifInfo;
  49     }
  50 
  51     public static CompositeData toCompositeData(MemoryNotificationInfo info) {
  52         MemoryNotifInfoCompositeData mnicd =
  53             new MemoryNotifInfoCompositeData(info);
  54         return mnicd.getCompositeData();
  55     }
  56 
  57     protected CompositeData getCompositeData() {
  58         // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
  59         // memoryNotifInfoItemNames!
  60         final Object[] memoryNotifInfoItemValues = {
  61             memoryNotifInfo.getPoolName(),
  62             MemoryUsageCompositeData.toCompositeData(memoryNotifInfo.getUsage()),
  63             memoryNotifInfo.getCount(),
  64         };
  65 
  66         try {
  67             return new CompositeDataSupport(memoryNotifInfoCompositeType,
  68                                             memoryNotifInfoItemNames,
  69                                             memoryNotifInfoItemValues);
  70         } catch (OpenDataException e) {
  71             // Should never reach here
  72             throw new AssertionError(e);
  73         }
  74     }
  75 
  76     private static final CompositeType memoryNotifInfoCompositeType;
  77     static {
  78         try {
  79             memoryNotifInfoCompositeType = (CompositeType)
  80                 MappedMXBeanType.toOpenType(MemoryNotificationInfo.class);
  81         } catch (OpenDataException e) {
  82             // Should never reach here
  83             throw new AssertionError(e);