[jboss-user] [JBoss jBPM] - Re: Configure JobExecutor in Spring

jeffj55374 do-not-reply at jboss.com
Tue Sep 25 14:37:57 EDT 2007


Hi,
I wrote my own sub class of JobExecutor since the setter methods where missing.  The code is below. The spring config is shown a the end.


  | package org.jbpm.job.executor;
  | 
  | import org.jbpm.JbpmConfiguration;
  | 
  | /** Extend JobExecutor to provide setter methods so JobExecutor can be created by Spring
  |  * 
  |  * @author jpjohnson
  |  *
  |  */
  | public class JbpmJobExecutor extends JobExecutor {
  | 	private static final long serialVersionUID = 1L;
  | 	/** Initialize this class and start the threads. Intended to be used via
  | 	 * Spring to begin execution of the threads. You may also want to specify 
  | 	 * lazy-init="true" in the Spring config file and explicitly load the bean
  | 	 * in your startup sequence.
  | 	 */
  | 	public void init()
  | 	{
  | 		this.start();
  | 	}
  | 	public void setJbpmConfiguration(JbpmConfiguration configuration)
  | 	{
  | 		jbpmConfiguration = configuration;
  | 	}
  | 	public void setName(String newName)
  | 	{
  | 		name = newName;
  | 	}
  | 	public void setNbrOfThreads(int value) {
  | 		nbrOfThreads = value;
  | 	}
  | 		public void setIdleInterval(int value) {
  | 			idleInterval = value;
  | 		}
  | 	public void setMaxIdleInterval(int value) {
  | 		maxIdleInterval = value;
  | 	}
  | 	public void setHistoryMaxSize(int value) {
  | 		historyMaxSize= value;
  | 	}
  | 
  | 	public void setMaxLockTime(int value) {
  | 		maxLockTime = value;
  | 	}
  | 	public void setLockMonitorInterval(int value) {
  | 		lockMonitorInterval = value;
  | 	}
  | 	public void setLockBufferTime(int value) {
  | 		lockBufferTime= value;
  | 	}
  | }
  | 

Here's the relevant section from my spring config.


  |   <!-- jBPM configuration -->
  |   <bean id="jbpmConfiguration"
  |       class="org.springmodules.workflow.jbpm31.LocalJbpmConfigurationFactoryBean">
  |     <property name="sessionFactory" ref="sessionFactory"/>
  |     <!-- property name="objectFactory" ref="jbpmObjectFactory"/-->
  |     <property name="configuration" value="classpath:/org/jbpm/default.jbpm.cfg.xml"/>
  |     <property name="createSchema"><value>false</value></property>
  |     <!--  
  |     	    <property name="processDefinitions">
  | 	     <list>
  | 	      <ref local="simpleWorkflow"/>
  | 	     </list>
  | 	    </property>
  | 	    <property name="createSchema" value="false"/>
  | 	    <property name="processDefinitionsResources">
  | 	     <list>
  | 	      <value>classpath:/org/springmodules/workflow/jbpm31/someOtherWorkflow.xml</value>
  | 	     </list>
  | 	    </property>
  |       -->
  |    </bean>
  |    <bean id="jbpmObjectFactory" class="org.springmodules.workflow.jbpm31.JbpmObjectFactory">
  |    </bean>
  |    <!-- JbpmJobExecutor is a DigitalRiver custom class to allow Spring to create JobExecutor -->
  |  <bean id="jbpm.job.executor" class="org.jbpm.job.executor.JbpmJobExecutor"
  |       lazy-init="true" init-method="init" destroy-method="stopAndJoin">
  |     <property name="jbpmConfiguration" ref="jbpmConfiguration" />
  |     <property name="name" value="JbpmJobExecutor"/> 
  |     <property name="nbrOfThreads" value="3"/>
  |     <property name="idleInterval" value="5000"/>
  |     <property name="maxIdleInterval" value="300000"/>
  |     <property name="historyMaxSize" value="20"/>
  |     <property name="maxLockTime" value="2147483646"/>          <!-- 10 minutes -->
  |     <property name="lockMonitorInterval" value="60000"/>  <!-- 1 minute -->
  |     <property name="lockBufferTime" value="5000"/>        <!-- 5 seconds -->
  |   </bean> 
  | 
  | 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4088550#4088550

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4088550



More information about the jboss-user mailing list