There is a lot of information about how to cancel/stop a SwingWorker. However I can not find a proper solution on how to stop a long lasting method started within the doInBackround()
method when cancel
is invoked from the EDT.
For instance, if a recursive file search is started within the doInBackround()
method using org.apache.commons.io.FileUtils.listFiles(file, FileUtils.getFileFilter(), DirectoryFileFilter.DIRECTORY);
, and cancel(true)
is invoked from the EDT, how can the file search be interrupted?