Skip to content

Commit 923c746

Browse files
author
Alan Bateman
committed
8298057: (fs) Remove PollingWatchService.POLLING_INIT_DELAY
Reviewed-by: bpb, jpai
1 parent 0bd04a6 commit 923c746

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/java.base/share/classes/sun/nio/fs/PollingWatchService.java

+4-7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2008, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2008, 2022, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -61,9 +61,7 @@
6161
class PollingWatchService
6262
extends AbstractWatchService
6363
{
64-
// Wait between polling thread creation and first poll (seconds)
65-
private static final int POLLING_INIT_DELAY = 1;
66-
// Default time between polls (seconds)
64+
// default polling interval in seconds
6765
private static final int DEFAULT_POLLING_INTERVAL = 2;
6866

6967
// map of registrations
@@ -252,7 +250,6 @@ void update(long lastModified, int tickCount) {
252250
* directory and queue keys when entries are added, modified, or deleted.
253251
*/
254252
private class PollingWatchKey extends AbstractWatchKey {
255-
256253
private final Object fileKey;
257254

258255
// current event set
@@ -311,10 +308,10 @@ void enable(Set<? extends WatchEvent.Kind<?>> events, long period) {
311308
// update the events
312309
this.events = events;
313310

314-
// create the periodic task with initialDelay set to the specified constant
311+
// create the periodic task to poll directories
315312
Runnable thunk = new Runnable() { public void run() { poll(); }};
316313
this.poller = scheduledExecutor
317-
.scheduleAtFixedRate(thunk, POLLING_INIT_DELAY, period, TimeUnit.SECONDS);
314+
.scheduleAtFixedRate(thunk, period, period, TimeUnit.SECONDS);
318315
}
319316
}
320317

0 commit comments

Comments
 (0)