Author: bbrodt
Date: 2010-05-18 22:30:41 -0400 (Tue, 18 May 2010)
New Revision: 659
Modified:
branches/ODE/ODE-1.x-fixes/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
branches/ODE/ODE-1.x-fixes/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
trunk/runtime/engine/src/main/java/org/apache/ode/store/RiftSawProcessStore.java
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
Log:
https://jira.jboss.org/browse/RIFTSAW-155
1. ProcessStoreImpl.retirePreviousPackageVersions() is different for Riftsaw vs ODE, so
had to change base class visibility of this method to protected and override in
RiftSawProcessStore.
2. applied "incomplete.patch" from
https://issues.apache.org/jira/browse/ODE-697
- this sure helped.
3. override for ProcessStore.setState() in RiftSawProcessStore adds code to retire
currently active process version if a different version is activated
Modified:
branches/ODE/ODE-1.x-fixes/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
===================================================================
---
branches/ODE/ODE-1.x-fixes/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java 2010-05-18
16:38:39 UTC (rev 658)
+++
branches/ODE/ODE-1.x-fixes/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java 2010-05-19
02:30:41 UTC (rev 659)
@@ -317,7 +317,11 @@
List<BpelProcess> processes = _serviceMap.get(e.serviceName);
if (processes == null) {
processes = new ArrayList<BpelProcess>();
- _serviceMap.put(e.serviceName, processes);
+ //
https://jira.jboss.org/browse/RIFTSAW-155
+ // this is the "incomplete.patch" from
+ //
https://issues.apache.org/jira/browse/ODE-697
+ if (process.getConf().getState() == ProcessState.ACTIVE)
+ _serviceMap.put(e.serviceName, processes);
}
// Remove any older version of the process from the list
Iterator<BpelProcess> processesIter = processes.iterator();
@@ -339,7 +343,11 @@
}
}
- processes.add(process);
+ //
https://jira.jboss.org/browse/RIFTSAW-155
+ // this is the "incomplete.patch" from
+ //
https://issues.apache.org/jira/browse/ODE-697
+ if (process.getConf().getState() == ProcessState.ACTIVE)
+ processes.add(process);
}
process.activate(this);
}
Modified:
branches/ODE/ODE-1.x-fixes/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
===================================================================
---
branches/ODE/ODE-1.x-fixes/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java 2010-05-18
16:38:39 UTC (rev 658)
+++
branches/ODE/ODE-1.x-fixes/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java 2010-05-19
02:30:41 UTC (rev 659)
@@ -73,7 +73,7 @@
private Map<QName, ProcessConfImpl> _processes = new HashMap<QName,
ProcessConfImpl>();
- private Map<String, DeploymentUnitDir> _deploymentUnits = new
HashMap<String, DeploymentUnitDir>();
+ protected Map<String, DeploymentUnitDir> _deploymentUnits = new
HashMap<String, DeploymentUnitDir>();
/** Guards access to the _processes and _deploymentUnits */
private final ReadWriteLock _rw = new ReentrantReadWriteLock();
@@ -326,7 +326,10 @@
* "AbsenceRequest([-\\.](\d)+)?/AbsenceRequest.ode" will be matched
against
* "AbsenceRequest-2/AbsenceRequest.ode" and setRetirePackage() will be
called accordingly.
*/
- private void retirePreviousPackageVersions(DeploymentUnitDir du) {
+ //
https://jira.jboss.org/browse/RIFTSAW-155
+ // need to override this in RiftSawProcessStore because Riftsaw deployment unit
naming
+ // is different from ODE.
+ protected void retirePreviousPackageVersions(DeploymentUnitDir du) {
//retire all the other versions of the same DU
String[] nameParts = du.getName().split("/");
/* Replace the version number (if any) with regexp to match any version number
*/
@@ -424,6 +427,24 @@
} finally {
_rw.readLock().unlock();
}
+
+ //
https://jira.jboss.org/browse/RIFTSAW-155
+ if (ProcessState.ACTIVE.equals(state)) {
+ // this version is being activated: check if another version of this
+ // process type is already active and if so, retire it.
+ Iterator<ProcessConfImpl> processesIter =
_processes.values().iterator();;
+ while (processesIter.hasNext()) {
+ ProcessConfImpl other_pconf = processesIter.next();
+ QName other_pid = other_pconf.getProcessId();
+ __log.debug("other pid " + other_pid + " vs this pid " +
pid);
+ if (ProcessState.ACTIVE.equals(other_pconf.getState()) &&
+ pconf.getType().equals(other_pconf.getType()) &&
+ !pid.equals(other_pid))
+ {
+ setState(other_pconf.getProcessId(),ProcessState.RETIRED);
+ }
+ }
+ }
final DeploymentUnitDir dudir = pconf.getDeploymentUnit();
Modified:
trunk/runtime/engine/src/main/java/org/apache/ode/store/RiftSawProcessStore.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/apache/ode/store/RiftSawProcessStore.java 2010-05-18
16:38:39 UTC (rev 658)
+++
trunk/runtime/engine/src/main/java/org/apache/ode/store/RiftSawProcessStore.java 2010-05-19
02:30:41 UTC (rev 659)
@@ -19,7 +19,11 @@
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.naming.InitialContext;
import javax.sql.DataSource;
@@ -28,12 +32,14 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.ode.bpel.compiler.api.CompilationException;
+import org.apache.ode.bpel.engine.BpelProcess;
//import org.apache.ode.bpel.extension.ExtensionValidator;
import org.apache.ode.bpel.iapi.ContextException;
import org.apache.ode.bpel.iapi.EndpointReferenceContext;
import org.apache.ode.bpel.iapi.ProcessState;
import org.apache.ode.bpel.iapi.ProcessStoreEvent;
import org.apache.ode.il.config.OdeConfigProperties;
+import org.apache.ode.store.ProcessStoreImpl.Callable;
import org.jboss.soa.bpel.deployer.BPELDeployer;
import org.jboss.soa.bpel.deployer.BPELDeploymentUnit;
@@ -87,6 +93,22 @@
}
*/
+ //
https://jira.jboss.org/browse/RIFTSAW-155
+ protected void retirePreviousPackageVersions(DeploymentUnitDir du) {
+ //retire all the other versions of the same DU
+ // Riftsaw deployment units are slightly different
+ String name = du.getName();
+ name = name.replaceAll("-(\\d)+\\.jar",
"-(\\\\d)+\\\\.jar");
+
+ Pattern duNamePattern = Pattern.compile(name);
+ for (String deployedDUname : _deploymentUnits.keySet()) {
+ Matcher matcher = duNamePattern.matcher(deployedDUname);
+ if (matcher.matches()) {
+ setRetiredPackage(deployedDUname, true);
+ }
+ }
+ }
+
public class DeployScheduler extends Thread {
public DeployScheduler() {
Modified:
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java
===================================================================
---
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2010-05-18
16:38:39 UTC (rev 658)
+++
trunk/runtime/engine/src/main/java/org/jboss/soa/bpel/runtime/engine/ode/BPELEngineImpl.java 2010-05-19
02:30:41 UTC (rev 659)
@@ -569,7 +569,9 @@
case ACTVIATED:
// bounce the process
_bpelServer.unregister(pse.pid);
- if (pconf != null) {
+ if (pconf != null && ProcessState.ACTIVE.equals(pconf.getState())) {
+ //
https://jira.jboss.org/browse/RIFTSAW-155
+ // only re-register if this process is still active
_bpelServer.register(pconf);
} else {
__log.debug("slighly odd: recevied event " +
@@ -582,7 +584,9 @@
// remove the process
_bpelServer.unregister(pse.pid);
// bounce the process if necessary
- if (instantiated) {
+ if (instantiated && pconf!=null &&
ProcessState.ACTIVE.equals(pconf.getState())) {
+ //
https://jira.jboss.org/browse/RIFTSAW-155
+ // only re-register if this process is still active
if (pconf != null) {
_bpelServer.register(pconf);
} else {