Refresh FileExplorer when directory changes occur

Hello.

I have implemented an FileExplorer in Vaadin and I would like to refresh the DataProvider when some changes occur in the main directory.

I have tested the WatchService from Java8 but when I implement this in Vaadin, it will block my whole application.

Hopefully someone can help me with this. Thanks for any advice!

You may already be aware of the [refreshAll]
(https://vaadin.com/download/release/8.4/8.4.1/docs/api/com/vaadin/data/provider/DataProvider.html#refreshAll--) method for DataProvider, so it sounds like your real problem is the blocking WatchService.

Without knowing much about your implementation, I can only advise you make sure to execute any asynchronous blocking actions in separate threads and then push any changes to your UI via [ui.access]
(https://vaadin.com/download/release/8.4/8.4.1/docs/api/com/vaadin/ui/UI.html#access-java.lang.Runnable-).