Uploaded image for project: 'Openfire'
  1. Openfire
  2. OF-497

Properly determine size of Collections to be cached

    XMLWordPrintable

    Details

      Description

      DefaultCache.calculateSize does not try very hard to deal with Collections and other
      not serializable components. Please note that an object does not have to be java.io.Serializable
      to be cached.

      A patch attached improves the situation described in the dicussion in two ways:

      • java.util.ArrayList$SubList and collections are handled properly now
      • not serializable objects (within a collection or not) will issue a warning:

      org.jivesoftware.util.cache.DefaultCache - Unable to determine size of class java.util.ArrayList instance
      with a stacktrace.

      A small jython script to demonstrate the issue is attached.

        Attachments

        1. cache-size.diff
          4 kB
        2. cachesizes.diff
          12 kB
        3. cachesizes-20111216.diff
          22 kB
        4. cache-test.py
          0.4 kB
        5. p1
          3 kB

          Activity

            People

            Assignee:
            guus Guus der Kinderen
            Reporter:
            saper Marcin Cieślak
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: