4646import jdk .jfr .internal .Logger ;
4747import jdk .jfr .internal .Repository ;
4848import jdk .jfr .internal .SecuritySupport .SafePath ;
49+ import jdk .jfr .internal .management .HiddenWait ;;
4950
5051public final class RepositoryFiles {
51- private static final Object WAIT_OBJECT = new Object ();
52+ private static final HiddenWait WAIT_OBJECT = new HiddenWait ();
5253 private static final String DIRECTORY_PATTERN = "DDDD_DD_DD_DD_DD_DD_" ;
5354 public static void notifyNewFile () {
5455 synchronized (WAIT_OBJECT ) {
@@ -59,15 +60,15 @@ public static void notifyNewFile() {
5960 private final FileAccess fileAccess ;
6061 private final NavigableMap <Long , Path > pathSet = new TreeMap <>();
6162 private final Map <Path , Long > pathLookup = new HashMap <>();
62- private final Object waitObject ;
63+ private final HiddenWait waitObject ;
6364 private boolean allowSubDirectory ;
6465 private volatile boolean closed ;
6566 private Path repository ;
6667
6768 public RepositoryFiles (FileAccess fileAccess , Path repository , boolean allowSubDirectory ) {
6869 this .repository = repository ;
6970 this .fileAccess = fileAccess ;
70- this .waitObject = repository == null ? WAIT_OBJECT : new Object ();
71+ this .waitObject = repository == null ? WAIT_OBJECT : new HiddenWait ();
7172 this .allowSubDirectory = allowSubDirectory ;
7273 }
7374
@@ -108,7 +109,7 @@ private boolean updatePaths(boolean wait) {
108109 // was accessed. Just ignore, and retry later.
109110 }
110111 if (wait ) {
111- nap ( );
112+ waitObject . takeNap ( 1000 );
112113 } else {
113114 return pathLookup .size () > beforeSize ;
114115 }
@@ -157,16 +158,6 @@ private Path path(long timestamp, boolean wait) {
157158 }
158159 }
159160
160- private void nap () {
161- try {
162- synchronized (waitObject ) {
163- waitObject .wait (1000 );
164- }
165- } catch (InterruptedException e ) {
166- // ignore
167- }
168- }
169-
170161 private boolean updatePaths () throws IOException , DirectoryIteratorException {
171162 boolean foundNew = false ;
172163 Path repoPath = repository ;
0 commit comments