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

    How to prevent user code be cached?


      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?



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

          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'/>
            <end name='end'/>

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

            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">



            <transition to="retreiveCatalogRequest"/>





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


            <property name="requestName">


            <string value="retrieveCatalog"/>




            <property name="requestData">






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


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






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


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






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


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






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


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








            <property name="springContextPath">


            <string value="serviceApplicationContext.xml"/>




            <property name="responseKey">


            <string value="catalogResponse"/>





            <transition to="retreiveCatalogResponse"/>






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

              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

              • 4. Re: How to prevent user code be cached?

                It works!