|
What if we added some code to com.gliffy.confluencePlugin.cache.ConfluenceCache.get() which attempts to detect the error condition.
For example, if the key starts with 'IMAGE', we could attempt to cast the object to DiagramBean in a try/catch block. If the object is non-null AND we get the ClassCastException AND the object is in Fact a DiagramBean, we know that the cache has likely been corrupted with the old objects. We should be able to call the removeAll() method on the cCache object, hopefully cleaning everything up. Since all this is happening in the 'ConfluenceCache' object, it will only be specific to the plugin. Do you think that would work? I've done a quick test just adding a try/catch block to the core core and ignoring the class cast exception at that point, this means the bean gets recreated then readded to the cache since to the following code it appears as though the image wasn't found in the cache.
It would be cleaner to put this in the confluence cache implementation but if it doesn't break the core code it will be more efficient to do it this way since we won't have to try{ cast }catch each object coming out of the confluence cache twice |
|||||||||||||||||||||||||||||||||||||||||||
I'm not sure if there is any way to get the plugin to "cleanup after itself " but we can possible catch the ClassCastException that is caused by this problem and get the cache flushed at that point. The interesting part will be making this confluence specific only since it doesn't apply to the online version of gliffy.