Commons VFS
  1. Commons VFS
  2. VFS-324

RamFileSystem.close() should clear the cache rather than nulling it

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 2.0
    • Labels:
      None

      Description

      RamFileSystem.close() should probably clear the cache rather than nulling it.

      This would allow the field to be made final, as well as avoiding an NPE if any methods using the cache are invoked after close.

      Making the field final would ensure it was published correctly - at present the class is not thread-safe

        Activity

        Hide
        Sebb added a comment -

        Fix looks OK, but I agree that the code is not thread-safe under all calling sequences. But at least the class data will be consistent across threads.

        The parent classes aren't thread-safe either, and have data publication problems.

        Show
        Sebb added a comment - Fix looks OK, but I agree that the code is not thread-safe under all calling sequences. But at least the class data will be consistent across threads. The parent classes aren't thread-safe either, and have data publication problems.
        Hide
        Ralph Goers added a comment -

        Please verify the fix.

        Show
        Ralph Goers added a comment - Please verify the fix.
        Hide
        Ralph Goers added a comment -

        I've applied that change but also noticed that the collection wasn't synchronized while iterating over it. I also noticed the same problems occur in RamFileData so addressed them there as well. However, I'm still not sure this code is completely thread safe.

        Show
        Ralph Goers added a comment - I've applied that change but also noticed that the collection wasn't synchronized while iterating over it. I also noticed the same problems occur in RamFileData so addressed them there as well. However, I'm still not sure this code is completely thread safe.

          People

          • Assignee:
            Unassigned
            Reporter:
            Sebb
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development