Merged V3.1 to HEAD

13077: Abstracted ContentStore MBean operations
   13099: Merge V3.0 to V3.1
      13096  Merged V2.2 to V3.0
         13071: Fix ETWOTWO-1058: Hibernate exception while concurrently submitting from and updating same user sandbox.
         13079: Fix ETWOTWO-1117: Misleading exceptions reported during AVM flatten and update
   13102: [no comment]
   13112: Merged V3.0 to V3.1
      13111: Merged V2.2 to V3.0
         13110: Fix 2.1 -> 2.2 upgrade on Postgres
   13114: Build/test fix (Enterprise Remote API project does not yet have any Java files to generate Javadoc)
   13117: DM Index Check - unit test improvements
   13123: *RECORD ONLY* Removed svn:mergeinfo fluff
   13124: Used newer, more efficient NodeService.addProperties method instead of many NodeService.setProperty calls
   13125: Added M2Binding for 'child-association': propagateTimestamps'
   13126: WCM unit tests - reduce build/test time to check (async) submits
   13127: Minor test fix - to allow it to run locally (on Mac OS X)
   13130: Support for 'maxRetries' of zero or less
   13131: Merged V3.0 to V3.1
      13025 *RECORD-ONLY*: Removed unnecessary svn:mergeinfo
      13026: Merged V2.2 to V3.0
         12964: Fixed ETWOTWO-968: Space rules are not run when saving from MS Word
         12993 *RECORD-ONLY*: added openoffice bootstrap context to sample-extensions
         13009 *RECORD-ONLY*: Avoid default OOo config from causing problems on zip/gz installs
   13132: Updated svn:mergeinfo
   13134: ETHREEOH-1202 - initial fix and unit tests
   ___________________________________________________________________
   Modified: svn:mergeinfo
      Merged /alfresco/BRANCHES/V3.0:r13005,13025-13026,13030,13039,13042,13050,13053,13096,13098,13111
      Merged /alfresco/BRANCHES/V2.2:r12964,12993,13009,13071,13079,13110
      Merged /alfresco/BRANCHES/V3.1:r13077,13099,13102,13112,13114,13117,13123-13127,13130-13132,13134


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@13564 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2009-03-11 13:19:59 +00:00
parent 9d3fd6680d
commit cf86bf466c
46 changed files with 4765 additions and 4028 deletions

View File

@@ -28,6 +28,7 @@ import org.alfresco.service.ServiceRegistry;
import org.alfresco.service.transaction.TransactionService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.jbpm.JbpmConfiguration;
import org.jbpm.job.executor.JobExecutor;
import org.springframework.beans.factory.access.BeanFactoryLocator;
import org.springframework.beans.factory.access.BeanFactoryReference;
@@ -45,6 +46,7 @@ public class AlfrescoJobExecutor extends JobExecutor
private static Log log = LogFactory.getLog(JobExecutor.class);
private TransactionService transactionService;
private JbpmConfiguration jbpmConfiguration;
/**
@@ -55,6 +57,7 @@ public class AlfrescoJobExecutor extends JobExecutor
BeanFactoryLocator factoryLocator = new JbpmFactoryLocator();
BeanFactoryReference factory = factoryLocator.useBeanFactory(null);
transactionService = (TransactionService)factory.getFactory().getBean(ServiceRegistry.TRANSACTION_SERVICE.getLocalName());
jbpmConfiguration = (JbpmConfiguration)factory.getFactory().getBean("jbpm_configuration");
}
/**
@@ -74,7 +77,7 @@ public class AlfrescoJobExecutor extends JobExecutor
protected synchronized void startThread()
{
String threadName = getNextThreadName();
Thread thread = new AlfrescoJobExecutorThread(threadName, this, getJbpmConfiguration(), getIdleInterval(), getMaxIdleInterval(), getMaxLockTime(), getHistoryMaxSize());
Thread thread = new AlfrescoJobExecutorThread(threadName, this, jbpmConfiguration, getIdleInterval(), getMaxIdleInterval(), getMaxLockTime(), getHistoryMaxSize());
getThreads().put(threadName, thread);
log.debug("starting new job executor thread '" + threadName + "'");
thread.start();

View File

@@ -24,6 +24,11 @@
*/
package org.alfresco.repo.workflow.jbpm;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import org.alfresco.repo.transaction.RetryingTransactionHelper;
import org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback;
import org.jbpm.JbpmConfiguration;
import org.jbpm.job.Job;
@@ -38,6 +43,13 @@ import org.jbpm.job.executor.JobExecutorThread;
public class AlfrescoJobExecutorThread extends JobExecutorThread
{
private AlfrescoJobExecutor alfrescoJobExecutor;
private boolean isActive = true;
@Override
public void setActive(boolean isActive)
{
this.isActive = isActive;
}
/**
* Constructor
@@ -48,15 +60,52 @@ public class AlfrescoJobExecutorThread extends JobExecutorThread
this.alfrescoJobExecutor = jobExecutor;
}
@Override
protected Collection acquireJobs()
{
if (!isActive)
{
return Collections.EMPTY_LIST;
}
return alfrescoJobExecutor.getTransactionService().getRetryingTransactionHelper().doInTransaction(
new RetryingTransactionHelper.RetryingTransactionCallback<Collection>() {
public Collection execute() throws Throwable
{
return AlfrescoJobExecutorThread.super.acquireJobs();
}
});
}
@Override
protected Date getNextDueDate()
{
if (!isActive)
{
return null;
}
return alfrescoJobExecutor.getTransactionService().getRetryingTransactionHelper().doInTransaction(
new RetryingTransactionHelper.RetryingTransactionCallback<Date>() {
public Date execute() throws Throwable
{
return AlfrescoJobExecutorThread.super.getNextDueDate();
}
}, true);
}
/**
* {@inheritDoc}
*/
@Override
protected void executeJob(Job job)
{
if (!isActive)
{
return;
}
alfrescoJobExecutor.getTransactionService().getRetryingTransactionHelper().doInTransaction(new TransactionJob(job));
}
/**
* Helper class for holding Job reference
*
@@ -76,14 +125,15 @@ public class AlfrescoJobExecutorThread extends JobExecutorThread
this.job = job;
}
/**
* {@inheritDoc}
/* (non-Javadoc)
* @see org.alfresco.repo.transaction.RetryingTransactionHelper.RetryingTransactionCallback#execute()
*/
public Object execute() throws Throwable
{
AlfrescoJobExecutorThread.super.executeJob(job);
return null;
}
}
}

View File

@@ -89,7 +89,17 @@ public class AlfrescoTimer extends Timer
@SuppressWarnings("synthetic-access")
public Boolean doWork() throws Exception
{
return AlfrescoTimer.super.execute(jbpmContext);
boolean deleteTimer = AlfrescoTimer.super.execute(jbpmContext);
// NOTE: there may be an issue in jBPM where a timer that causes a process to
// end is deleted twice (once via specific delete operation and once via
// delete DML statement) which causes a hibernate exception.
// Only delete timer if not at end of process
if (getProcessInstance().getEnd() != null)
{
deleteTimer = false;
}
return deleteTimer;
}
}, (username == null) ? "system" : username);

View File

@@ -1,7 +1,14 @@
<jbpm-configuration>
<jbpm-configuration>
<jbpm-context>
<service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory" />
<service name="persistence">
<factory>
<bean class="org.jbpm.persistence.db.DbPersistenceServiceFactory">
<field name="isCurrentSessionEnabled"><true/></field>
<field name="isTransactionEnabled"><false/></field>
</bean>
</factory>
</service>
<service name="tx" factory="org.jbpm.tx.TxServiceFactory" />
<service name="message" factory="org.jbpm.msg.db.DbMessageServiceFactory" />
<service name="scheduler" factory="org.jbpm.scheduler.db.DbSchedulerServiceFactory" />
@@ -27,7 +34,7 @@
<bean name="jbpm.job.executor" class="org.alfresco.repo.workflow.jbpm.AlfrescoJobExecutor">
<field name="jbpmConfiguration"><ref bean="jbpmConfiguration" /></field>
<field name="name"><string value="AlfrescoJbpmJobExector" /></field>
<field name="name"><string value="AlfrescoJbpmJobExecutor" /></field>
<field name="nbrOfThreads"><int value="1" /></field>
<field name="idleInterval"><int value="90000" /></field> <!-- 15 minutes -->
<field name="maxIdleInterval"><int value="3600000" /></field> <!-- 1 hour -->