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.