Community
Participate
Working Groups
Build Identifier: eclipse-SDK-3.6RC4-win32 The TocServlet has a shared instance Map responseByLocale which tracks the toc xml returns for each locale that is requested. If the toc was built for a certain locale, and then changes to the help system are made elsewhere, there is no way to clear the responseByLocale cache to force a rebuild of the help system. It would be helpful to be able to programatically clear the TocServlet response cache if needed. Reproducible: Always Steps to Reproduce: 1. Call the TocServlet for a particular locale 3. Try to call TocServlet for same locale and have it rebuild
Created attachment 179914 [details] Patch for adding method to set the toc cache invalid which forces a refresh This path provides the method: public static void setCacheInvalid() { cacheInvalid=true; } So the toc cache can be forced to refresh if changes to the toc have been made. The variable is added to the check for determine if a new HashMap is needed. if (responseByLocale == null || cacheInvalid) { responseByLocale = new WeakHashMap(); }
Are you looking to create API so that an application which extends Eclipse can clear this cache? If so you would need to add the method to an API class - TocServlet is internal. The other problem with the patch is that once cacheInvalid is false it never gets reset to being true.
Hi Chris, Thanks for the response. I agree an API class would be better. Is there an an API class I can use as an example? Is there an existing API class that this method would make sense to go in? Also, the cacheInvalid does need to be set to true as you said.
So I think the public API might look someything like this: org.eclipse.help.webapp: org.eclipse.help.webapp.TocSystem TocSystem has a method, clearTocCache which calls the TocServlet.setCacheInvalid() method.
*** Bug 280457 has been marked as a duplicate of this bug. ***
Created attachment 187031 [details] Patch - Public API Version
I took a quick look at the patch and the API looks good. One thing we should think about is making this code thread safe - the current code is not perfect in that respect. I'm still trying to understand the initial requirement. Currently the help system works on the assumption that the table of contents does not change after it is first built and the TocServlet is just one instance of that assumption.
(In reply to comment #7) > I took a quick look at the patch and the API looks good. One thing we should > think about is making this code thread safe - the current code is not perfect > in that respect. Yeah - I was thinking the same, but I did not have time to come up with a solution for it. > I'm still trying to understand the initial requirement. Currently the help > system works on the assumption that the table of contents does not change after > it is first built and the TocServlet is just one instance of that assumption. The requirement is for doc installs. We need a way to update the Table of Contents after new doc has been installed, without restarting the help system. Internally, we have been using a clear cache patch on the org.eclipse.help.webapp plugin and it has been very helpful in refreshing the toc after new content has been installed.
Patch committed to HEAD