I use FileAlterationMonitor
from Apache and I would like to know when it is done initializing. I call
fileAlterationMonitor.start();
which starts a new thread and my program moves on, before fileAlterationMonitor
is done initializing. I would like to wait for the initialization to complete, but I cannot find a way to check when it is done.
I can sleep for a while, but how long to wait will vary based on speed of the computer.
I have looked at CountDownLatch
and that seems simple enough in my own code, but how do I use it on FileAlterationMonitor
? It cannot be extend it as it is final.
Is there a better solution than waiting "long enough"?