guvnor synchronization is enabled by default in 5.4. It uses KnowledgeAgent to perform the synchronization and rebuild internally knowledge base. Here is the code that might become useful when trying to debug it. I think that the root cause of this and slow loading of the processes is the same. Would it be possible for you to debug it and see there is the actual bottleneck that causes this delays? Especially for the first load as I believe the others are consequence of it.
Appreciate the pointer to the initial point in the code to start looking. I downloaded the DefaultKnowledgeBaseManager code, and added some println statements to it to help determine where the slow startup time is occurring. As it turns out, it spends all of its time (3 minutes and 10 seconds to be exact) in the following line of code in the buildKnowledgeAgent method:
I haven't had a chance to continue to dive into these classes, but at least know where its occurring. I will update this discussion with what I find out...
NOTE - I have been able to determine that the code IS picking up changes to processes in guvnor. I made some changes to a simple process in the web designer from guvnor, and after building the pkg associated with the process, and then logging back into the jbpm-console, it picked up the changed process - having the extra println's showed it was executing the syncPackages method in the DefaultKnowledgeBaseManager class.
Further research on this found the following code being executed:
Class Method Code
DefaultKnowledgeBaseManager buildKnowledgeAgent kagent.applyChangeSet(ResourceFactory.newReaderResource(guvnorUtils.createChangeSet()));
KnowledgeAgentImpl getChangeSet changeSet = reader.read( resourceReader );
ExtensibleXmlParser read localParser.parse(in, this);
Once it hit the localParser.parse, the delay would be exactly 190 seconds every time. Doing some searching on the web for issues that cause slow SAX parsing, I ran across the following link:
This suggested putting some code in just before the parse to ignore external references. So, I put the following code in right before the localParser.parse line as follows:
XMLReader reader = localParser.getXMLReader();
public InputSource resolveEntity(String pid, String sid) throws SAXException
return new InputSource(new StringReader(""));
When i replaced the original ExtensibleXmlParser with this modified one in the drools-core jar inside of jbpm-gwt-console-server, rebuilt and restarted my JBOSS instance, logged into the jbpm-console, and selected the processes tab, and then process overview, all of my processes were displayed within a few seconds.
As Maciej had alluded to in my discussion on slow loading of processes, this is related to the fact that our company doesn't allow access to the internet from applications behind our firewalls. Now seeing what the code is trying to do, is this modified code an acceptable workaround, or are there other alternatives? Waiting for over 3 minutes after startup is not an option, so hoping there might be other suggestions on how to fix this, short of this particular code.