Permalink
Browse files

Refactoring and tweaks of the async executor after some serious load …

…testing on AWS. Introduction of a Spring-JMS message-based async executor (easily portable to other flavors of messaging), also tested on AWS with some very nice results :-). A blog will follow soon.
  • Loading branch information...
1 parent 3603583 commit d08a247570336c872bb17ce513c1fb95b3ba47a2 @jbarrez jbarrez committed Jul 15, 2016
Showing with 854 additions and 310 deletions.
  1. +13 −6 modules/activiti-engine/src/main/java/org/activiti/engine/ManagementService.java
  2. +6 −0 modules/activiti-engine/src/main/java/org/activiti/engine/impl/ManagementServiceImpl.java
  3. +1 −1 ...viti-engine/src/main/java/org/activiti/engine/impl/asyncexecutor/AcquireAsyncJobsDueRunnable.java
  4. +1 −1 ...ctiviti-engine/src/main/java/org/activiti/engine/impl/asyncexecutor/AcquireTimerJobsRunnable.java
  5. +3 −7 modules/activiti-engine/src/main/java/org/activiti/engine/impl/asyncexecutor/AsyncExecutor.java
  6. +98 −74 ...activiti-engine/src/main/java/org/activiti/engine/impl/asyncexecutor/DefaultAsyncJobExecutor.java
  7. +103 −56 modules/activiti-engine/src/main/java/org/activiti/engine/impl/asyncexecutor/DefaultJobManager.java
  8. +41 −25 ...es/activiti-engine/src/main/java/org/activiti/engine/impl/asyncexecutor/ExecuteAsyncRunnable.java
  9. +2 −2 ...viti-engine/src/main/java/org/activiti/engine/impl/asyncexecutor/ExecuteAsyncRunnableFactory.java
  10. +13 −0 modules/activiti-engine/src/main/java/org/activiti/engine/impl/asyncexecutor/JobManager.java
  11. +2 −2 ...activiti-engine/src/main/java/org/activiti/engine/impl/asyncexecutor/ManagedAsyncJobExecutor.java
  12. +3 −1 ...les/activiti-engine/src/main/java/org/activiti/engine/impl/asyncexecutor/ResetExpiredJobsCmd.java
  13. +2 −2 ...ctiviti-engine/src/main/java/org/activiti/engine/impl/asyncexecutor/ResetExpiredJobsRunnable.java
  14. +10 −17 .../main/java/org/activiti/engine/impl/asyncexecutor/multitenant/ExecutorPerTenantAsyncExecutor.java
  15. +4 −3 ...n/java/org/activiti/engine/impl/asyncexecutor/multitenant/SharedExecutorServiceAsyncExecutor.java
  16. +1 −1 .../java/org/activiti/engine/impl/asyncexecutor/multitenant/TenantAwareAcquireTimerJobsRunnable.java
  17. +3 −3 ...main/java/org/activiti/engine/impl/asyncexecutor/multitenant/TenantAwareExecuteAsyncRunnable.java
  18. +3 −3 ...va/org/activiti/engine/impl/asyncexecutor/multitenant/TenantAwareExecuteAsyncRunnableFactory.java
  19. +22 −2 ...es/activiti-engine/src/main/java/org/activiti/engine/impl/cfg/ProcessEngineConfigurationImpl.java
  20. +10 −10 modules/activiti-engine/src/main/java/org/activiti/engine/impl/cmd/ExecuteAsyncJobCmd.java
  21. +65 −0 ...tiviti-engine/src/main/java/org/activiti/engine/impl/cmd/MoveDeadLetterJobToExecutableJobCmd.java
  22. +6 −4 ...activiti-engine/src/main/java/org/activiti/engine/impl/jobexecutor/AsyncJobAddedNotification.java
  23. +35 −0 modules/activiti-engine/src/main/java/org/activiti/engine/impl/util/Activiti5Util.java
  24. +5 −0 modules/activiti-engine/src/test/java/org/activiti/engine/test/api/mgmt/JobQueryTest.java
  25. +1 −1 ...s/activiti-engine/src/test/java/org/activiti/engine/test/jobexecutor/JobExecutorCmdHappyTest.java
  26. +1 −0 modules/activiti-jms-spring-executor/.gitignore
  27. +152 −0 modules/activiti-jms-spring-executor/pom.xml
  28. +40 −0 ...tiviti-jms-spring-executor/src/main/java/org/activiti/spring/executor/jms/JobMessageListener.java
  29. +69 −0 ...ti-jms-spring-executor/src/main/java/org/activiti/spring/executor/jms/MessageBasedJobManager.java
  30. +108 −0 modules/activiti-jms-spring-executor/src/test/java/org/activiti/spring/executor/jms/MyConfig.java
  31. +6 −9 modules/activiti-spring/src/main/java/org/activiti/spring/SpringAsyncExecutor.java
  32. +2 −1 modules/activiti-spring/src/main/java/org/activiti/spring/SpringCallerRunsRejectedJobsHandler.java
  33. +0 −59 ...iviti5-spring-test/src/test/java/org/activiti5/spring/test/jobexecutor/SpringJobExecutorTest.java
  34. +1 −1 ...test/src/test/resources/org/activiti5/spring/test/autodeployment/SpringAutoDeployTest-context.xml
  35. +1 −1 ...es/org/activiti5/spring/test/autodeployment/SpringAutoDeployTest-create-drop-clean-db-context.xml
  36. +1 −1 .../org/activiti5/spring/test/autodeployment/SpringAutoDeployTest-deploymentmode-default-context.xml
  37. +1 −1 ...spring/test/autodeployment/SpringAutoDeployTest-deploymentmode-resource-parent-folder-context.xml
  38. +1 −1 ...iviti5/spring/test/autodeployment/SpringAutoDeployTest-deploymentmode-single-resource-context.xml
  39. +1 −1 .../test/resources/org/activiti5/spring/test/autodeployment/SpringAutoDeployTest-no-drop-context.xml
  40. +1 −1 ...iti5-spring-test/src/test/resources/org/activiti5/spring/test/components/ScopingTests-context.xml
  41. +1 −1 ...ng-test/src/test/resources/org/activiti5/spring/test/components/SpringjobExecutorTest-context.xml
  42. +1 −1 ...spring-test/src/test/resources/org/activiti5/spring/test/components/StateHandlerTests-context.xml
  43. +1 −1 ...pring-test/src/test/resources/org/activiti5/spring/test/email/jndiEmailConfiguaration-context.xml
  44. +1 −1 ...5-spring-test/src/test/resources/org/activiti5/spring/test/engine/springProcessEngine-context.xml
  45. +1 −1 ...ources/org/activiti5/spring/test/expression/callactivity/testCallActivityByExpression-context.xml
  46. +1 −1 ...g-test/src/test/resources/org/activiti5/spring/test/expression/expressionLimitedBeans-context.xml
  47. +1 −1 .../activiti5-spring-test/src/test/resources/org/activiti5/spring/test/jpa/JPASpringTest-context.xml
  48. +1 −1 ...pring-test/src/test/resources/org/activiti5/spring/test/junit4/springTypicalUsageTest-context.xml
  49. +1 −1 .../test/resources/org/activiti5/spring/test/servicetask/serviceraskSpringTestCatchError-context.xml
  50. +1 −1 ...t/resources/org/activiti5/spring/test/taskListener/TaskListenerDelegateExpressionTest-context.xml
  51. +1 −1 ...pring-test/src/test/resources/org/activiti5/spring/test/taskassignment/taskassignment-context.xml
  52. +1 −1 ...test/resources/org/activiti5/spring/test/transaction/SpringTransactionIntegrationTest-context.xml
  53. +1 −1 ...t/src/test/resources/org/activiti5/standalone/cfg/identity/customIdentitySession-activiti.cfg.xml
  54. +3 −0 pom.xml
@@ -112,6 +112,19 @@
* when there is no job with the given id.
*/
Job moveJobToDeadLetterJob(String jobId);
+
+ /**
+ * Moves a job that is in the dead letter job table back to be an executable job,
+ * and resetting the retries (as the retries was 0 when it was put into the dead letter job table).
+ *
+ * @param jobId
+ * id of the job to move, cannot be null.
+ * @param retries
+ * the number of retries (value greater than 0) which will be set on the job.
+ * @throws ActivitiObjectNotFoundException
+ * when there is no job with the given id.
+ */
+ Job moveDeadLetterJobToExecutableJob(String jobId, int retries);
/**
* Delete the job with the provided id.
@@ -243,24 +256,18 @@
<T> T executeCommand(CommandConfig config, Command<T> command);
/**
- * [EXPERIMENTAL]
- *
* Executes the sql contained in the {@link CustomSqlExecution} parameter.
*/
<MapperType, ResultType> ResultType executeCustomSql(CustomSqlExecution<MapperType, ResultType> customSqlExecution);
/**
- * [EXPERIMENTAL]
- *
* Returns a list of event log entries, describing everything the engine has processed. Note that the event logging must specifically must be enabled in the process engine configuration.
*
* Passing null as arguments will effectively fetch ALL event log entries. Be careful, as this list might be huge!
*/
List<EventLogEntry> getEventLogEntries(Long startLogNr, Long pageSize);
/**
- * [EXPERIMENTAL]
- *
* Returns a list of event log entries for a specific process instance id. Note that the event logging must specifically must be enabled in the process engine configuration.
*
* Passing null as arguments will effectively fetch ALL event log entries. Be careful, as this list might be huge!
@@ -34,6 +34,7 @@
import org.activiti.engine.impl.cmd.GetTableMetaDataCmd;
import org.activiti.engine.impl.cmd.GetTableNameCmd;
import org.activiti.engine.impl.cmd.JobType;
+import org.activiti.engine.impl.cmd.MoveDeadLetterJobToExecutableJobCmd;
import org.activiti.engine.impl.cmd.MoveJobToDeadLetterJobCmd;
import org.activiti.engine.impl.cmd.MoveTimerToExecutableJobCmd;
import org.activiti.engine.impl.cmd.SetJobRetriesCmd;
@@ -95,6 +96,11 @@ public Job moveTimerToExecutableJob(String jobId) {
public Job moveJobToDeadLetterJob(String jobId) {
return commandExecutor.execute(new MoveJobToDeadLetterJobCmd(jobId));
}
+
+ @Override
+ public Job moveDeadLetterJobToExecutableJob(String jobId, int retries) {
+ return commandExecutor.execute(new MoveDeadLetterJobToExecutableJobCmd(jobId, retries));
+ }
public void deleteJob(String jobId) {
commandExecutor.execute(new DeleteJobCmd(jobId));
@@ -45,7 +45,7 @@ public synchronized void run() {
log.info("{} starting to acquire async jobs due");
Thread.currentThread().setName("activiti-acquire-async-jobs");
- final CommandExecutor commandExecutor = asyncExecutor.getCommandExecutor();
+ final CommandExecutor commandExecutor = asyncExecutor.getProcessEngineConfiguration().getCommandExecutor();
while (!isInterrupted) {
@@ -49,7 +49,7 @@ public synchronized void run() {
log.info("{} starting to acquire async jobs due");
Thread.currentThread().setName("activiti-acquire-timer-jobs");
- final CommandExecutor commandExecutor = asyncExecutor.getCommandExecutor();
+ final CommandExecutor commandExecutor = asyncExecutor.getProcessEngineConfiguration().getCommandExecutor();
while (!isInterrupted) {
@@ -12,7 +12,7 @@
*/
package org.activiti.engine.impl.asyncexecutor;
-import org.activiti.engine.impl.interceptor.CommandExecutor;
+import org.activiti.engine.impl.cfg.ProcessEngineConfigurationImpl;
import org.activiti.engine.impl.persistence.entity.JobEntity;
import org.activiti.engine.runtime.Job;
@@ -42,13 +42,9 @@
/* Getters and Setters */
- void setCommandExecutor(CommandExecutor commandExecutor);
+ void setProcessEngineConfiguration(ProcessEngineConfigurationImpl processEngineConfiguration);
- CommandExecutor getCommandExecutor();
-
- void setJobManager(JobManager jobManager);
-
- JobManager getJobManager();
+ ProcessEngineConfigurationImpl getProcessEngineConfiguration();
boolean isAutoActivate();
Oops, something went wrong.

0 comments on commit d08a247

Please sign in to comment.