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

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


  88                                 Field f = cl.getDeclaredField("extAttributes");
  89                                 f.setAccessible(true);
  90                                 return (Object[])f.get(info);
  91                             } catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
  92                                 return null;
  93                             }
  94                         }
  95                     });
  96         GcInfoCompositeData gcicd =
  97             new GcInfoCompositeData(info,builder,extAttr);
  98         return gcicd.getCompositeData();
  99     }
 100 
 101     protected CompositeData getCompositeData() {
 102         // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
 103         // baseGcInfoItemNames!
 104         final Object[] baseGcInfoItemValues;
 105 
 106         try {
 107             baseGcInfoItemValues = new Object[] {
 108                 new Long(info.getId()),
 109                 new Long(info.getStartTime()),
 110                 new Long(info.getEndTime()),
 111                 new Long(info.getDuration()),
 112                 memoryUsageMapType.toOpenTypeData(info.getMemoryUsageBeforeGc()),
 113                 memoryUsageMapType.toOpenTypeData(info.getMemoryUsageAfterGc()),
 114             };
 115         } catch (OpenDataException e) {
 116             // Should never reach here
 117             throw new AssertionError(e);
 118         }
 119 
 120         // Get the item values for the extension attributes
 121         final int gcExtItemCount = builder.getGcExtItemCount();
 122         if (gcExtItemCount == 0 &&
 123             gcExtItemValues != null && gcExtItemValues.length != 0) {
 124             throw new AssertionError("Unexpected Gc Extension Item Values");
 125         }
 126 
 127         if (gcExtItemCount > 0 && (gcExtItemValues == null ||
 128              gcExtItemCount != gcExtItemValues.length)) {
 129             throw new AssertionError("Unmatched Gc Extension Item Values");
 130         }
 131 




  88                                 Field f = cl.getDeclaredField("extAttributes");
  89                                 f.setAccessible(true);
  90                                 return (Object[])f.get(info);
  91                             } catch(ClassNotFoundException | NoSuchFieldException | IllegalAccessException e) {
  92                                 return null;
  93                             }
  94                         }
  95                     });
  96         GcInfoCompositeData gcicd =
  97             new GcInfoCompositeData(info,builder,extAttr);
  98         return gcicd.getCompositeData();
  99     }
 100 
 101     protected CompositeData getCompositeData() {
 102         // CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
 103         // baseGcInfoItemNames!
 104         final Object[] baseGcInfoItemValues;
 105 
 106         try {
 107             baseGcInfoItemValues = new Object[] {
 108                 info.getId(),
 109                 info.getStartTime(),
 110                 info.getEndTime(),
 111                 info.getDuration(),
 112                 memoryUsageMapType.toOpenTypeData(info.getMemoryUsageBeforeGc()),
 113                 memoryUsageMapType.toOpenTypeData(info.getMemoryUsageAfterGc()),
 114             };
 115         } catch (OpenDataException e) {
 116             // Should never reach here
 117             throw new AssertionError(e);
 118         }
 119 
 120         // Get the item values for the extension attributes
 121         final int gcExtItemCount = builder.getGcExtItemCount();
 122         if (gcExtItemCount == 0 &&
 123             gcExtItemValues != null && gcExtItemValues.length != 0) {
 124             throw new AssertionError("Unexpected Gc Extension Item Values");
 125         }
 126 
 127         if (gcExtItemCount > 0 && (gcExtItemValues == null ||
 128              gcExtItemCount != gcExtItemValues.length)) {
 129             throw new AssertionError("Unmatched Gc Extension Item Values");
 130         }
 131