[config-core] sleep 1s between iterations in watch service loop to free up CPU (wasn't needed that often anyway)
This commit is contained in:
parent
a548bba60a
commit
457c1f4d85
|
@ -7,7 +7,7 @@ public abstract class ThreadCoProcess implements CoProcess, Runnable {
|
||||||
public void start() {
|
public void start() {
|
||||||
if (th != null) stop();
|
if (th != null) stop();
|
||||||
closed = false;
|
closed = false;
|
||||||
th = new Thread(this);
|
th = new Thread(this, getClass().getSimpleName());
|
||||||
th.start();
|
th.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,11 @@ public class JfConfigWatchService extends ThreadCoProcess implements Closeable {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void executeIteration() {
|
public void executeIteration() {
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException ignored) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
synchronized (CONFIG_DIR) {
|
synchronized (CONFIG_DIR) {
|
||||||
WatchKey key = service.poll();
|
WatchKey key = service.poll();
|
||||||
if (key != null) {
|
if (key != null) {
|
||||||
|
|
Loading…
Reference in New Issue