< prev index next >

core/org.openjdk.jmc.flightrecorder.rules/src/main/java/org/openjdk/jmc/flightrecorder/rules/util/RulesToolkit.java

Print this page

        

@@ -109,23 +109,24 @@
         private static final String REC_SETTING_NAME_ENABLED = "enabled"; //$NON-NLS-1$
         private static final String REC_SETTING_NAME_THRESHOLD = "threshold"; //$NON-NLS-1$
         public static final String REC_SETTING_NAME_PERIOD = "period"; //$NON-NLS-1$
         public static final String REC_SETTING_PERIOD_EVERY_CHUNK = "everyChunk"; //$NON-NLS-1$
 
+        /*
+         * Returns the type name, as available in the recording settings, or simply the type id, if not
+         * available.
+         */
         private static final IAccessorFactory<String> TYPE_NAME_ACCESSOR_FACTORY = new IAccessorFactory<String>() {
-
                 @Override
-                public <T> IMemberAccessor<String, T> getAccessor(IType<T> type) {
+                public <T> IMemberAccessor<String, T> getAccessor(final IType<T> type) {
                         final IMemberAccessor<LabeledIdentifier, T> ta = JdkAttributes.REC_SETTING_FOR.getAccessor(type);
                         return new IMemberAccessor<String, T>() {
-
                                 @Override
                                 public String getMember(T inObject) {
-                                        LabeledIdentifier eventType = ta.getMember(inObject);
-                                        return eventType == null ? null : eventType.getName();
+                                        LabeledIdentifier labeledIdentifier = ta.getMember(inObject);
+                                        return labeledIdentifier == null ? type.getIdentifier() : labeledIdentifier.getName();
                                 }
-
                         };
                 }
         };
         private final static LinearUnit MEBIBYTES = UnitLookup.MEMORY.getUnit(BinaryPrefix.MEBI);
 

@@ -420,11 +421,11 @@
          *
          * @param items
          *            the collection to check.
          * @param typeIds
          *            the identifiers for the event types to check.
-         * @return true if all of the required event types were known to be explicitly enabled.
+         * @return true if all of the required event types were known to be explicitly disabled.
          */
         private static boolean isEventsDisabled(IItemCollection items, String ... typeIds) {
                 IQuantity aggregate = items.apply(createEnablementFilter(false, typeIds)).getAggregate(Aggregators.count());
                 return aggregate != null && aggregate.longValue() == typeIds.length;
         }

@@ -940,10 +941,13 @@
         private static Set<String> getPeriodSettings(IItemCollection items, String ... typeIds) {
                 IItemFilter filter = getSettingsFilter(REC_SETTING_NAME_PERIOD, typeIds);
                 return items.apply(filter).getAggregate(Aggregators.distinct(JdkAttributes.REC_SETTING_VALUE));
         }
 
+        /**
+         * Returns the names of the explicitly disabled event types.
+         */
         private static String getDisabledEventTypeNames(IItemCollection items, String ... typeIds) {
                 return getEventTypeNames(items.apply(createEnablementFilter(false, typeIds)));
         }
 
         private static String getEventTypeNames(IItemCollection items, String ... typeIds) {
< prev index next >