jglobus/JGlobus — pull request #141 by paulmillar (2014-09-01 10:20:05+00:00)
Title: Avoid memory leak and stale information when scanning directories

The GlobusPathMatchingResourcePatternResolver class can scan a
filesystem for files matching some pattern. Instances of this class
maintain an internal list of matches. Successive calls to the
getResources method will append matching file paths and return the
complete list. Note that (currently) there is no mechanism to reset the
internal list.

The ResourceSigningPolicyStore reuses the same Resolver instance for all
loadPolicy method calls, with three bad effects:

1. files are included multiple times, potentially resulting in
loading a policy file multiple times;

2. the result list will always increase, eventually triggering an
OOM;

3. if a file is removed then, as the Resolver's result list will
continue to have the file, an error will be reported. The negative
cache alieviates this third problem so an error is reported once
every 10 hours.

This patch modifies the code so loadPolicy method creates a new Resolver
for each loadPolicy method call. There is no additional filesystem
overhead (the previous code would also always scan the directory), but
the results are now accurate and do not contain duplicates.

Target: master
Request: 2.1
Request: 2.0