Uploaded image for project: 'Openfire'
  1. OF-1679

DefaultCache does not honour Map contract

    Details

    • Type: Bug
    • Status: Resolved (View workflow)
    • Priority: Major
    • Resolution: Fixed
    • Affects versions: 4.3.0
    • Fix versions: 4.4.0
    • Components: Core
    • Labels:
      None

      Description

      The DefaultCache implementation implements the Map interface. There are three methods that do not correctly implement this interface;

      Note 1: The PR at https://github.com/igniterealtime/Openfire/pull/1235 (which also references https://issues.igniterealtime.org/browse/OF-867) highlights an bug that has been caused by an assumption that the DefaultCache supports the Map interface. 

      Note 2: ClusteredCache from the Hazelcast plugin does the right thing - by leveraging the Hazelcast implementation.

      I can see three options;

      1. Make the sets returned from entrySet() and keySet() read-only, and update the Javadoc for the Cache to reflect this state. Update the ClusteredCache similarly. Also double check the code base to find any incorrect use of these methods in addition to that highlighted in OF-867 Reopened .
      2. Update all three methods to return a collections that align with Map documentation. NB. This is a non-trivial exercise.
      3. Replace the DefaultCache with a Caffeine Cache - https://github.com/ben-manes/caffeine which supports these methods as documented.

       

       

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                Greg Thomas
                Reporter:
                Greg Thomas
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: