diff --git a/jbpm-flow/src/main/java/org/jbpm/process/core/timer/JobNameHelper.java b/jbpm-flow/src/main/java/org/jbpm/process/core/timer/JobNameHelper.java index 246e9cc198..6be48d0ef3 100644 --- a/jbpm-flow/src/main/java/org/jbpm/process/core/timer/JobNameHelper.java +++ b/jbpm-flow/src/main/java/org/jbpm/process/core/timer/JobNameHelper.java @@ -16,6 +16,7 @@ package org.jbpm.process.core.timer; import org.drools.core.time.JobContext; +import org.jbpm.process.core.timer.impl.GlobalTimerService.GlobalJobHandle; import org.jbpm.process.instance.timer.TimerManager.ProcessJobContext; import org.jbpm.process.instance.timer.TimerManager.StartProcessJobContext; import org.kie.api.runtime.EnvironmentName; @@ -55,7 +56,16 @@ public static String getGroupName(JobContext ctx) { String groupName = "jbpm"; if (ctx instanceof ProcessJobContext) { ProcessJobContext processCtx = (ProcessJobContext) ctx; - String deploymentId = (String) processCtx.getKnowledgeRuntime().getEnvironment().get(EnvironmentName.DEPLOYMENT_ID); + + String deploymentId = null; + if (processCtx.getJobHandle() instanceof GlobalJobHandle) { + deploymentId = ((GlobalJobHandle) processCtx.getJobHandle()).getDeploymentId(); + } + + if (deploymentId == null) { + deploymentId = (String) processCtx.getKnowledgeRuntime().getEnvironment().get(EnvironmentName.DEPLOYMENT_ID); + } + if (deploymentId != null) { groupName = deploymentId; } diff --git a/jbpm-flow/src/main/java/org/jbpm/process/core/timer/impl/GlobalTimerService.java b/jbpm-flow/src/main/java/org/jbpm/process/core/timer/impl/GlobalTimerService.java index 9e2fa765d7..ad3226e008 100644 --- a/jbpm-flow/src/main/java/org/jbpm/process/core/timer/impl/GlobalTimerService.java +++ b/jbpm-flow/src/main/java/org/jbpm/process/core/timer/impl/GlobalTimerService.java @@ -351,6 +351,10 @@ public GlobalJobHandle(long id) { super(id); } + public String getDeploymentId() { + return null; + } + public Long getTimerId() { JobContext ctx = this.getTimerJobInstance().getJobContext(); if (ctx instanceof SelfRemovalJobContext) { diff --git a/jbpm-flow/src/main/java/org/jbpm/process/instance/timer/TimerManager.java b/jbpm-flow/src/main/java/org/jbpm/process/instance/timer/TimerManager.java index 7f79999f2d..d62990d098 100644 --- a/jbpm-flow/src/main/java/org/jbpm/process/instance/timer/TimerManager.java +++ b/jbpm-flow/src/main/java/org/jbpm/process/instance/timer/TimerManager.java @@ -199,9 +199,6 @@ public void cancelTimer(long processInstnaceId, long timerId) { } public void dispose() { - // for ( TimerInstance timer : timers.values() ) { - // timerService.removeJob( timer.getJobHandle() ); - // } if (timerService instanceof RegisteredTimerServiceDelegate) { timers.clear(); return; diff --git a/jbpm-services/jbpm-services-ejb/jbpm-services-ejb-timer/src/main/java/org/jbpm/services/ejb/timer/EjbGlobalJobHandle.java b/jbpm-services/jbpm-services-ejb/jbpm-services-ejb-timer/src/main/java/org/jbpm/services/ejb/timer/EjbGlobalJobHandle.java index 0bbb9de049..6526bca467 100644 --- a/jbpm-services/jbpm-services-ejb/jbpm-services-ejb-timer/src/main/java/org/jbpm/services/ejb/timer/EjbGlobalJobHandle.java +++ b/jbpm-services/jbpm-services-ejb/jbpm-services-ejb-timer/src/main/java/org/jbpm/services/ejb/timer/EjbGlobalJobHandle.java @@ -34,6 +34,7 @@ public String toString() { return "EjbGlobalJobHandle [uuid=" + getUuid() + "]"; } + @Override public String getDeploymentId() { return deploymentId; }