mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
8303681: JFR: RemoteRecordingStream::setMaxAge() should accept null
Reviewed-by: mgronlun
This commit is contained in:
@@ -409,7 +409,9 @@ final class DiskRepository implements Closeable {
|
||||
|
||||
public synchronized void setMaxAge(Duration maxAge) {
|
||||
this.maxAge = maxAge;
|
||||
trimToAge(Instant.now().minus(maxAge));
|
||||
if (maxAge != null) {
|
||||
trimToAge(Instant.now().minus(maxAge));
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void setMaxSize(long maxSize) {
|
||||
|
||||
@@ -410,7 +410,6 @@ public final class RemoteRecordingStream implements EventStream {
|
||||
* state
|
||||
*/
|
||||
public void setMaxAge(Duration maxAge) {
|
||||
Objects.requireNonNull(maxAge);
|
||||
synchronized (lock) {
|
||||
repository.setMaxAge(maxAge);
|
||||
this.maxAge = maxAge;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@@ -49,7 +49,7 @@ public class TestDelegated {
|
||||
}
|
||||
|
||||
// The assumption here is that the following methods don't
|
||||
// need t be tested fully since they all delegate to the
|
||||
// need to be tested fully since they all delegate to the
|
||||
// same implementation class that is tested elsewhere.
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
@@ -70,12 +70,8 @@ public class TestDelegated {
|
||||
|
||||
private static void testSetMaxAge() throws Exception {
|
||||
try (RemoteRecordingStream stream = new RemoteRecordingStream(CONNECTION)) {
|
||||
try {
|
||||
stream.setMaxAge(Duration.ofHours(1));
|
||||
stream.setMaxAge(null);
|
||||
throw new Exception("Expected NullPointerException");
|
||||
} catch (NullPointerException npe) {
|
||||
// As expected
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user