Author: jeff.yuchang
Date: 2010-12-01 02:07:21 -0500 (Wed, 01 Dec 2010)
New Revision: 1168
Modified:
branches/RiftSaw-ODE-2.2.x/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
branches/RiftSaw-ODE-2.2.x/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
branches/RiftSaw-ODE-2.2.x/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
branches/RiftSaw-ODE-2.2.x/dao-jpa-hibernate/.project
branches/RiftSaw-ODE-2.2.x/dao-jpa-ojpa/.project
Log:
* RIFTSAW-238, fix the process undeployment mechanism.
Modified:
branches/RiftSaw-ODE-2.2.x/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java
===================================================================
---
branches/RiftSaw-ODE-2.2.x/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java 2010-11-29
03:32:46 UTC (rev 1167)
+++
branches/RiftSaw-ODE-2.2.x/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelEngineImpl.java 2010-12-01
07:07:21 UTC (rev 1168)
@@ -271,8 +271,8 @@
return new PartnerRoleMessageExchangeImpl(this, mexdao, ptype, op, null,
plink.hasMyRole() ? process
.getInitialMyRoleEPR(plink) : null,
process.getPartnerRoleChannel(plink));
}
-
- BpelProcess unregisterProcess(QName process) {
+
+ public BpelProcess unregisterProcess(QName process) {
BpelProcess p = _activeProcesses.remove(process);
__log.debug("Unregister process: serviceId=" + process + ",
process=" + p);
if (p != null) {
@@ -289,9 +289,9 @@
}
}
}
-
+
// unregister the services provided by the process
- p.deactivate();
+ p.deactivate();
// release the resources held by this process
p.dehydrate();
// update the process footprints list
@@ -312,18 +312,14 @@
* Register a process with the engine.
* @param process the process to register
*/
- void registerProcess(BpelProcess process) {
+ public void registerProcess(BpelProcess process) {
_activeProcesses.put(process.getPID(), process);
for (Endpoint e : process.getServiceNames()) {
__log.debug("Register process: serviceId=" + e + ",
process=" + process);
List<BpelProcess> processes = _serviceMap.get(e.serviceName);
if (processes == null) {
processes = new ArrayList<BpelProcess>();
- //
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);
+ _serviceMap.put(e.serviceName, processes);
}
// Remove any older version of the process from the list
Iterator<BpelProcess> processesIter = processes.iterator();
@@ -333,7 +329,7 @@
if (cachedVersion.getProcessType().equals(process.getProcessType())) {
//Check for versions to retain newer one
if (cachedVersion.getVersion() > process.getVersion()) {
- __log.debug("removing current version");
+ __log.debug("deactivating current version");
process.activate(this);
process.deactivate();
return;
@@ -345,11 +341,9 @@
}
}
- //
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);
+
+
+ processes.add(process);
}
process.activate(this);
}
@@ -739,7 +733,7 @@
}
}
faultQName = constants.qnRetiredProcess;
- faultDetail.setTextContent("The process you're trying to
instantiate has been retired.");
+ faultDetail.setTextContent("The process you are trying to
instantiate has been retired. Retired process can not take any new instance
creation.");
break;
case InvalidProcessException.DEFAULT_CAUSE_CODE:
default:
Modified:
branches/RiftSaw-ODE-2.2.x/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java
===================================================================
---
branches/RiftSaw-ODE-2.2.x/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java 2010-11-29
03:32:46 UTC (rev 1167)
+++
branches/RiftSaw-ODE-2.2.x/bpel-runtime/src/main/java/org/apache/ode/bpel/engine/BpelProcess.java 2010-12-01
07:07:21 UTC (rev 1168)
@@ -627,27 +627,21 @@
}
void deactivate() {
- // the BindingContext contains only the endpoints for the latest process version
- if (org.apache.ode.bpel.iapi.ProcessState.ACTIVE.equals(_pconf.getState())) {
- // Deactivate all the my-role endpoints.
- for (Endpoint endpoint : _myEprs.keySet()) {
- // Deactivate the EPR only if there are no more references
- // to this endpoint from any (active) BPEL process.
- if (isShareable(endpoint)) {
- if(__log.isDebugEnabled()) __log.debug("deactivating shared
endpoint " + endpoint+ " for pid "+ _pid);
- if (!_sharedEps.decrementReferenceCount(endpoint)) {
-
_engine._contexts.bindingContext.deactivateMyRoleEndpoint(endpoint);
- _sharedEps.removeEndpoint(endpoint);
- }
- } else {
- if(__log.isDebugEnabled()) __log.debug("deactivating non-shared
endpoint " + endpoint + " for pid "+ _pid);
- _engine._contexts.bindingContext.deactivateMyRoleEndpoint(endpoint);
- }
- }
- // TODO Deactivate all the partner-role channels
- } else {
- if(__log.isDebugEnabled()) __log.debug("pid "+_pid+" is not
ACTIVE, no endpoints to deactivate");
- }
+ // Deactivate all the my-role endpoints.
+ for (Endpoint endpoint : _myEprs.keySet()) {
+ // Deactivate the EPR only if there are no more references
+ // to this endpoint from any (active) BPEL process.
+ if (isShareable(endpoint)) {
+ if(__log.isDebugEnabled()) __log.debug("deactivating shared endpoint
" + endpoint+ " for pid "+ _pid);
+ if (!_sharedEps.decrementReferenceCount(endpoint)) {
+ _engine._contexts.bindingContext.deactivateMyRoleEndpoint(endpoint);
+ _sharedEps.removeEndpoint(endpoint);
+ }
+ } else {
+ if(__log.isDebugEnabled()) __log.debug("deactivating non-shared
endpoint " + endpoint + " for pid "+ _pid);
+ _engine._contexts.bindingContext.deactivateMyRoleEndpoint(endpoint);
+ }
+ }
}
private boolean isShareable(Endpoint endpoint) {
Modified:
branches/RiftSaw-ODE-2.2.x/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
===================================================================
---
branches/RiftSaw-ODE-2.2.x/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java 2010-11-29
03:32:46 UTC (rev 1167)
+++
branches/RiftSaw-ODE-2.2.x/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java 2010-12-01
07:07:21 UTC (rev 1168)
@@ -338,23 +338,10 @@
// 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
*/
- nameParts[0] = nameParts[0].replaceAll("([-\\Q.\\E](\\d)+)?\\z",
"");
- nameParts[0] += "([-\\Q.\\E](\\d)+)?";
- StringBuilder duNameRegExp = new StringBuilder(du.getName().length() * 2);
- for (int i = 0, n = nameParts.length; i < n; i++) {
- if (i > 0) duNameRegExp.append("/");
- duNameRegExp.append(nameParts[i]);
+ List<String> deployedDUNames = getPreviousPackageVersions(du.getName());
+ for (String deployedDUName : deployedDUNames) {
+ setRetiredPackage(deployedDUName, true);
}
-
- Pattern duNamePattern = Pattern.compile(duNameRegExp.toString());
- for (String deployedDUname : _deploymentUnits.keySet()) {
- Matcher matcher = duNamePattern.matcher(deployedDUname);
- if (matcher.matches()) {
- setRetiredPackage(deployedDUname, true);
- }
- }
}
public Collection<QName> undeploy(final File dir) {
@@ -492,6 +479,49 @@
setState(toPid(processName, duDir.getVersion()), retired ?
ProcessState.RETIRED : ProcessState.ACTIVE);
}
}
+
+
+ public String getLatestPackageVersion(String duName) {
+ List<String> packages = getPreviousPackageVersions(duName);
+ if (packages.size() < 1) {
+ return null;
+ }
+ String result = null;
+ long version = -1;
+ for (String theDUName : packages) {
+ DeploymentUnitDir duDir = _deploymentUnits.get(theDUName);
+ if (duDir.getVersion() > version) {
+ version = duDir.getVersion();
+ result = theDUName;
+ }
+ }
+ return result;
+ }
+
+ public List<String> getPreviousPackageVersions(String duName) {
+ List<String> duNames = new ArrayList<String>();
+ String[] nameParts = duName.split("/");
+ /* Replace the version number (if any) with regexp to match any version number */
+ nameParts[0] = nameParts[0].replaceAll("([-\\Q.\\E](\\d)+)?\\z",
"");
+ nameParts[0] += "([-\\Q.\\E](\\d)+)?";
+ StringBuilder duNameRegExp = new StringBuilder(duName.length() * 2);
+ for (int i = 0, n = nameParts.length; i < n; i++) {
+ if (i > 0) {
+ duNameRegExp.append("/");
+ }
+ duNameRegExp.append(nameParts[i]);
+ }
+
+ Pattern duNamePattern = Pattern.compile(duNameRegExp.toString());
+ for (String deployedDUname : _deploymentUnits.keySet()) {
+ Matcher matcher = duNamePattern.matcher(deployedDUname);
+ if (matcher.matches()) {
+ duNames.add(deployedDUname);
+ }
+ }
+
+ return duNames;
+ }
public ProcessConf getProcessConfiguration(final QName processId) {
_rw.readLock().lock();
Modified: branches/RiftSaw-ODE-2.2.x/dao-jpa-hibernate/.project
===================================================================
--- branches/RiftSaw-ODE-2.2.x/dao-jpa-hibernate/.project 2010-11-29 03:32:46 UTC (rev
1167)
+++ branches/RiftSaw-ODE-2.2.x/dao-jpa-hibernate/.project 2010-12-01 07:07:21 UTC (rev
1168)
@@ -1,6 +1,6 @@
<projectDescription>
<name>riftsaw-dao-jpa-hibernate</name>
- <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the
maven-eclipse-plugin are not supported in M2Eclipse.</comment>
+ <comment>RiftSaw - the JBoss BPEL engine. NO_M2ECLIPSE_SUPPORT: Project files
created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects>
<project>riftsaw-bpel-api</project>
<project>riftsaw-bpel-dao</project>
Modified: branches/RiftSaw-ODE-2.2.x/dao-jpa-ojpa/.project
===================================================================
--- branches/RiftSaw-ODE-2.2.x/dao-jpa-ojpa/.project 2010-11-29 03:32:46 UTC (rev 1167)
+++ branches/RiftSaw-ODE-2.2.x/dao-jpa-ojpa/.project 2010-12-01 07:07:21 UTC (rev 1168)
@@ -1,6 +1,6 @@
<projectDescription>
<name>riftsaw-dao-jpa-ojpa</name>
- <comment>NO_M2ECLIPSE_SUPPORT: Project files created with the
maven-eclipse-plugin are not supported in M2Eclipse.</comment>
+ <comment>RiftSaw - the JBoss BPEL engine. NO_M2ECLIPSE_SUPPORT: Project files
created with the maven-eclipse-plugin are not supported in M2Eclipse.</comment>
<projects>
<project>riftsaw-bpel-api</project>
<project>riftsaw-bpel-dao</project>