On large trees of directories the call to FileObject.addRecursiveListener can be quite expensive. See bug 178999 for an example. Although the problem can be workarounded by rescheduling to the call to addRL to some background thread, it may need nicer API. One option is
public boolean addRecusiveListener(FCL, Callable<Boolean> callback);
which will allow the client to provide a callback and return false from it, to immediately stop further execution, effectively removing the listener.
Created attachment 94953 [details]
Created attachment 94959 [details]
Test for the new behavior
Let's integrate tomorrow.
[JG01] Do not copy every detail of Javadoc; we cannot maintain duplicated specs. Refer to the simple overload for details, and only document the stop param.