< prev index next >

core/org.openjdk.jmc.flightrecorder/src/main/java/org/openjdk/jmc/flightrecorder/parser/synthetic/SyntheticAttributeExtension.java

Print this page




 156                                                 List<ValueField> newDataStructure = new ArrayList<>(dataStructure);
 157                                                 newDataStructure.add(new ValueField(JdkAttributes.EXPORTING_MODULE));
 158                                                 IEventSink subSink = sf.create(identifier, label, category, description, newDataStructure);
 159                                                 IEventSink moduleExportSink = new ModuleExportSink(subSink, packageIndex);
 160                                                 return moduleExportSink;
 161                                         }
 162                                 }
 163                                 return sf.create(identifier, label, category, description, dataStructure);
 164                         }
 165 
 166                         @Override
 167                         public void flush() {
 168                                 sf.flush();
 169                         }
 170                 });
 171         }
 172 
 173         @Override
 174         public String getValueInterpretation(String eventTypeId, String fieldId) {
 175                 if (REC_SETTING_EVENT_ID_ATTRIBUTE.getIdentifier().equals(fieldId)
 176                                 && JdkTypeIDsPreJdk11.RECORDING_SETTING.equals(eventTypeId)) {
 177                         return JfrInternalConstants.TYPE_IDENTIFIER_VALUE_INTERPRETATION;
 178                 }
 179                 if (REC_SETTING_EVENT_ID_ATTRIBUTE.getIdentifier().equals(fieldId)
 180                                 && JdkTypeIDs.RECORDING_SETTING.equals(JdkTypeIDsPreJdk11.translate(eventTypeId))) {
 181                         return JfrInternalConstants.TYPE_IDENTIFIER_VALUE_INTERPRETATION;
 182                 }
 183                 return null;
 184         }
 185 
 186         private static class ModuleExportSink implements IEventSink {
 187                 private final IEventSink subSink;
 188                 private final int packageFieldIndex;
 189 
 190                 public ModuleExportSink(IEventSink subSink, int packageFieldIndex) {
 191                         this.subSink = subSink;
 192                         this.packageFieldIndex = packageFieldIndex;
 193                 }
 194 
 195                 @Override
 196                 public void addEvent(Object[] values) {
 197                         IMCPackage thePackage = (IMCPackage) values[packageFieldIndex];
 198                         IMCModule exportingModule = thePackage.getModule();
 199                         Object[] newValues = new Object[values.length + 1];
 200                         System.arraycopy(values, 0, newValues, 0, values.length);


 156                                                 List<ValueField> newDataStructure = new ArrayList<>(dataStructure);
 157                                                 newDataStructure.add(new ValueField(JdkAttributes.EXPORTING_MODULE));
 158                                                 IEventSink subSink = sf.create(identifier, label, category, description, newDataStructure);
 159                                                 IEventSink moduleExportSink = new ModuleExportSink(subSink, packageIndex);
 160                                                 return moduleExportSink;
 161                                         }
 162                                 }
 163                                 return sf.create(identifier, label, category, description, dataStructure);
 164                         }
 165 
 166                         @Override
 167                         public void flush() {
 168                                 sf.flush();
 169                         }
 170                 });
 171         }
 172 
 173         @Override
 174         public String getValueInterpretation(String eventTypeId, String fieldId) {
 175                 if (REC_SETTING_EVENT_ID_ATTRIBUTE.getIdentifier().equals(fieldId)
 176                                 && (JdkTypeIDsPreJdk11.RECORDING_SETTING.equals(eventTypeId) ||
 177                                     JdkTypeIDsPreJdk11.JDK9_RECORDING_SETTING.equals(eventTypeId) ||
 178                                     JdkTypeIDs.RECORDING_SETTING.equals(eventTypeId))) {


 179                         return JfrInternalConstants.TYPE_IDENTIFIER_VALUE_INTERPRETATION;
 180                 }
 181                 return null;
 182         }
 183 
 184         private static class ModuleExportSink implements IEventSink {
 185                 private final IEventSink subSink;
 186                 private final int packageFieldIndex;
 187 
 188                 public ModuleExportSink(IEventSink subSink, int packageFieldIndex) {
 189                         this.subSink = subSink;
 190                         this.packageFieldIndex = packageFieldIndex;
 191                 }
 192 
 193                 @Override
 194                 public void addEvent(Object[] values) {
 195                         IMCPackage thePackage = (IMCPackage) values[packageFieldIndex];
 196                         IMCModule exportingModule = thePackage.getModule();
 197                         Object[] newValues = new Object[values.length + 1];
 198                         System.arraycopy(values, 0, newValues, 0, values.length);
< prev index next >