|
1 | 1 | /*
|
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. |
3 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
4 | 4 | *
|
5 | 5 | * This code is free software; you can redistribute it and/or modify it
|
|
61 | 61 | class PollingWatchService
|
62 | 62 | extends AbstractWatchService
|
63 | 63 | {
|
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 |
67 | 65 | private static final int DEFAULT_POLLING_INTERVAL = 2;
|
68 | 66 |
|
69 | 67 | // map of registrations
|
@@ -252,7 +250,6 @@ void update(long lastModified, int tickCount) {
|
252 | 250 | * directory and queue keys when entries are added, modified, or deleted.
|
253 | 251 | */
|
254 | 252 | private class PollingWatchKey extends AbstractWatchKey {
|
255 |
| - |
256 | 253 | private final Object fileKey;
|
257 | 254 |
|
258 | 255 | // current event set
|
@@ -311,10 +308,10 @@ void enable(Set<? extends WatchEvent.Kind<?>> events, long period) {
|
311 | 308 | // update the events
|
312 | 309 | this.events = events;
|
313 | 310 |
|
314 |
| - // create the periodic task with initialDelay set to the specified constant |
| 311 | + // create the periodic task to poll directories |
315 | 312 | Runnable thunk = new Runnable() { public void run() { poll(); }};
|
316 | 313 | this.poller = scheduledExecutor
|
317 |
| - .scheduleAtFixedRate(thunk, POLLING_INIT_DELAY, period, TimeUnit.SECONDS); |
| 314 | + .scheduleAtFixedRate(thunk, period, period, TimeUnit.SECONDS); |
318 | 315 | }
|
319 | 316 | }
|
320 | 317 |
|
|
0 commit comments