Skip to content

Commit

Permalink
Reduce the number of dangling FileListeners due to collect operation.
Browse files Browse the repository at this point in the history
  • Loading branch information
ecki committed May 23, 2024
1 parent 4c0d55a commit 60ae76f
Showing 1 changed file with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,15 @@ public DarcFileCollectOperation(FileObject root)
public void process()
throws FileSystemException
{
if (root instanceof DarcFileObject)
if !(root instanceof DarcFileObject)
{
return;
}

final DarcFileObject darcFile = (DarcFileObject) root;
final FileObject delegateFile = darcFile.getDelegateFile();
try
{
DarcFileObject darcFile = (DarcFileObject) root;
FileObject delegateFile = darcFile.getDelegateFile();

filesList.add(delegateFile.getName().getURI());

if (darcFile.getType() == FileType.FOLDER)
Expand All @@ -70,5 +74,10 @@ public void process()
}
}
}
finally
{
// we can speed up freeing this listener darcFile is no longer needed
delegateFile.getFileSystem().removeListener(delegateFile, darcFile);
}
}
}

0 comments on commit 60ae76f

Please sign in to comment.