[jboss-user] [JBoss jBPM] - Re: Solution: JBPM3 and Spring Integration
mr_magoo
do-not-reply at jboss.com
Wed Aug 19 19:37:10 EDT 2009
Other java classes we use that are almost the same or identical as the ones in the articles. Just for completeness.
Lock monitor thread:
public class SpringLockMonitorThread extends LockMonitorThread {
| private TransactionTemplate transactionTemplate;
|
| public SpringLockMonitorThread(JbpmConfiguration jbpmConfiguration,
| int lockMonitorInterval, int maxLockTime, int lockBufferTime, TransactionTemplate transactionTemplate) {
| super(jbpmConfiguration, lockMonitorInterval, maxLockTime,lockBufferTime);
| this.transactionTemplate = transactionTemplate;
| }
| @Override
| protected void unlockOverdueJobs() {
| transactionTemplate.execute(new TransactionCallback() {
| public Object doInTransaction(TransactionStatus transactionStatus) {
| SpringLockMonitorThread.super.unlockOverdueJobs();
| return null;
| }
| });
| }
| public void setTransactionTemplate(TransactionTemplate transactionTemplate) {
| this.transactionTemplate = transactionTemplate;
| }
| }
|
Job executor:
public class SpringJobExecutor extends JobExecutor {
| private TransactionTemplate transactionTemplate;
|
| @Override
| public synchronized void start() {
| if (!isStarted) {
| for (int i = 0; i < nbrOfThreads; i++) {
| startThread();
| }
| lockMonitorThread = new SpringLockMonitorThread(jbpmConfiguration, lockMonitorInterval, maxLockTime, lockBufferTime, transactionTemplate);
| isStarted = true;
| }
| }
| @Override
| protected Thread createThread(String threadName) {
| log.info("Creating JobExecutor thread " + threadName);
| return new GfgSpringExecutorThread(threadName, this, jbpmConfiguration, transactionTemplate, idleInterval, maxIdleInterval, maxLockTime, historyMaxSize);
| }
| public void setTransactionTemplate(TransactionTemplate transactionTemplate) {
| this.transactionTemplate = transactionTemplate;
| }
| }
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4250515#4250515
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4250515
More information about the jboss-user
mailing list