Skip to content

Commit e34323d

Browse files
committed
6141: JMC logs warnings when creating recordings
Reviewed-by: hirt, jpbempel
1 parent 7f38790 commit e34323d

File tree

4 files changed

+13
-2
lines changed

4 files changed

+13
-2
lines changed

application/org.openjdk.jmc.flightrecorder.configuration/src/main/java/org/openjdk/jmc/flightrecorder/configuration/internal/CommonConstraints.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
import static org.openjdk.jmc.common.unit.UnitLookup.BYTE;
4141
import static org.openjdk.jmc.common.unit.UnitLookup.DAY;
4242
import static org.openjdk.jmc.common.unit.UnitLookup.EPOCH_MS;
43+
import static org.openjdk.jmc.common.unit.UnitLookup.EPOCH_NS;
4344
import static org.openjdk.jmc.common.unit.UnitLookup.HOUR;
4445
import static org.openjdk.jmc.common.unit.UnitLookup.MEMORY;
4546
import static org.openjdk.jmc.common.unit.UnitLookup.MINUTE;
@@ -270,7 +271,7 @@ public IQuantity parsePersisted(String persistedValue) throws QuantityConversion
270271
}
271272

272273
public final static IConstraint<IQuantity> POSITIVE_TIMESPAN = new ComparableConstraint<>(
273-
new TimePersisterBrokenSI(), SECOND.quantity(0), YEAR.quantity(200));
274+
new TimePersisterBrokenSI(), SECOND.quantity(0), EPOCH_NS.quantity(Long.MAX_VALUE));
274275
public final static IConstraint<IQuantity> PERIOD_V1 = new ComparableConstraint<>(new PeriodPersister(),
275276
NANOSECOND.quantity(1), YEAR.quantity(1));
276277
public final static IConstraint<IQuantity> PERIOD_V2 = new ComparableConstraint<>(new PeriodPersisterV2(),

application/org.openjdk.jmc.rjmx.services.jfr/src/main/java/org/openjdk/jmc/rjmx/services/jfr/internal/EventTypeMetadataV2.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
* Provides information about an event type for JFR 2.0.
5353
*/
5454
public final class EventTypeMetadataV2 implements IEventTypeInfo {
55-
private static final String JFR_SETTINGS_PERIOD = "com.oracle.jfr.settings.Period"; //$NON-NLS-1$
55+
private static final String JFR_SETTINGS_PERIOD = "jdk.settings.Period"; //$NON-NLS-1$
5656
private final Long id;
5757
private final EventTypeIDV2 eventTypeID;
5858
private final String label;

core/org.openjdk.jmc.common/src/main/java/org/openjdk/jmc/common/unit/LinearKindOfQuantity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ public class LinearKindOfQuantity extends KindOfQuantity<LinearUnit> {
8484
private static final FormatThreadLocal<NumberFormat> NUMBER_FORMAT_INTERACTIVE_HOLDER;
8585
// Holder of display number formatter/parser, which may contain non-breaking spaces.
8686
private static final FormatThreadLocal<NumberFormat> NUMBER_FORMAT_DISPLAY_HOLDER;
87+
private static final String INFINITY = "infinity"; //$NON-NLS-1$
8788

8889
protected final LinearUnit atomUnit;
8990
// Since units no longer have an explicit name, only a description, use this to generate prefixed names.
@@ -613,6 +614,9 @@ public ITypedQuantity<LinearUnit> parsePersisted(String persistedQuantity) throw
613614
throw QuantityConversionException.unknownUnit(persistedQuantity, getDefaultUnit().quantity(1234.0));
614615
}
615616
}
617+
if (INFINITY.equals(persistedQuantity)) {
618+
return UnitLookup.NANOSECOND.quantity(Long.MAX_VALUE);
619+
}
616620
throw QuantityConversionException.unparsable(persistedQuantity, getDefaultUnit().quantity(1234.0));
617621
}
618622

core/tests/org.openjdk.jmc.common.test/src/test/java/org/openjdk/jmc/common/test/unit/ContentTypeTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,10 @@ public void testCustomUnitConversion() throws Exception {
250250
AdHocQuantityTest.assertNearlySame(quantity, wellKnown);
251251
}
252252

253+
@Test
254+
public void testPersistedQuantityInfinity() throws Exception {
255+
ITypedQuantity<LinearUnit> quantity = TIMESPAN.parsePersisted("infinity");
256+
assertEquals(quantity.longValue(), Long.MAX_VALUE);
257+
}
258+
253259
}

0 commit comments

Comments
 (0)