4 Replies Latest reply on Nov 5, 2010 3:05 PM by Bo meng

    How to prevent user code be cached?

    Bo meng Newbie

      Hi there,

       

      I am new to Jbpm. I noticed in the developer guide it said:

       

      In case you do have a need for stateful user objects, you can specify parameter cache="disabled" on the definition of the user code. In that case a new user code object will be instatiated for every usage.

       

       

      How do we set  this feature? cache="disabled". Do we set it in the jbpl file or in the java code?

      Thanks,

      Bo

        • 1. Re: How to prevent user code be cached?
          Michael Wohlfart Expert

          Hi Bo,

          you set it in your jbpl definition, check out the testcases,

          this is an example from Huisheng Xu's CacheParsingTest.java:

           

          <process name='MyProcess' xmlns='http://jbpm.org/4.4/jpdl'>
            <start name='start'>
              <transition name='myTransition' to='end'>
                <event-listener class='com.comp.MyEventListener' cache='disabled'/>
              </transition>
            </start>
            <end name='end'/>
          </process>

          • 2. Re: How to prevent user code be cached?
            Bo meng Newbie

            Thanks a lot Michael,

            Does that mean if I have a below jbpl file, I need set like that?

            <?xml version="1.0" encoding="UTF-8"?>

            <process name="retrieveCatalog" xmlns="http://jbpm.org/4.0/jpdl">

            <start>

             

            <transition to="retreiveCatalogRequest"/>

             

            </start>

             

             

            <custom name="retreiveCatalogRequest" class="com.mytest.workflow.activity.MakeServiceRequest" cache="disabled">

             

            <property name="requestName">

             

            <string value="retrieveCatalog"/>

             

            </property>

             

            <property name="requestData">

             

            <map>

             

            <entry>

             

            <key><string value="application"/></key>

             

            <value><object expr="#{requestData.application}"/></value>

             

            </entry>

             

            <entry>

             

            <key><string value="product"/></key>

             

            <value><object expr="#{requestData.product}"/></value>

             

            </entry>S

             

            <entry>

             

            <key><string value="loyaltyProgram"/></key>

             

            <value><object expr="#{requestData.loyaltyProgram}"/></value>

             

            </entry>

             

            <entry>

             

            <key><string value="catalogKey"/></key>

             

            <value><object expr="#{requestData.type}"/></value>

             

            </entry>

             

            </map>

             

            </property>

             

            <property name="springContextPath">

             

            <string value="serviceApplicationContext.xml"/>

             

            </property>

             

            <property name="responseKey">

             

            <string value="catalogResponse"/>

             

            </property>

             

             

            <transition to="retreiveCatalogResponse"/>

             

            </custom>

             

             

             

            • 3. Re: How to prevent user code be cached?
              Michael Wohlfart Expert

              well my eyes are still bleeding from looking at your messy xml,

              but as far as I can tell cache should work for the custom tag