Skip to content

Commit

Permalink
Use blocking method rather than the throwing one
Browse files Browse the repository at this point in the history
Avoid:
Exception in thread Thread-7 java.lang.IllegalStateException: Queue full
        at java.base/java.util.AbstractQueue.add(AbstractQueue.java:98)
        at java.base/java.util.concurrent.ArrayBlockingQueue.add(ArrayBlockingQueue.java:326)
        at org.jbake.maven.util.DirWatcher.onUpdated(DirWatcher.java:57)
        at org.jbake.maven.util.DirWatcher.accessbash00(DirWatcher.java:17)
        at org.jbake.maven.util.DirWatcher.onFileChange(DirWatcher.java:40)
        at org.apache.commons.io.monitor.FileAlterationObserver.doMatch(FileAlterationObserver.java:410)
        at org.apache.commons.io.monitor.FileAlterationObserver.checkAndNotify(FileAlterationObserver.java:333)
        at org.apache.commons.io.monitor.FileAlterationObserver.checkAndNotify(FileAlterationObserver.java:334)
        at org.apache.commons.io.monitor.FileAlterationObserver.checkAndNotify(FileAlterationObserver.java:303)
        at org.apache.commons.io.monitor.FileAlterationMonitor.run(FileAlterationMonitor.java:183)
        at java.base/java.lang.Thread.run(Thread.java:829)
which stops further processing of changed files.
  • Loading branch information
pzygielo committed Jan 5, 2022
1 parent aa14595 commit 6b200da
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ public void stop() {
}

private void onUpdated() {
changeQueue.add(Long.valueOf(System.currentTimeMillis()));
try {
changeQueue.put(Long.valueOf(System.currentTimeMillis()));
} catch (InterruptedException iex) {
Thread.currentThread().interrupt();
}
}

/**
Expand Down

0 comments on commit 6b200da

Please sign in to comment.