Author: mriou
Date: Tue Aug 14 16:32:26 2007
New Revision: 565969

URL: http://svn.apache.org/viewvc?view=rev&rev=565969
Log:
Cleaning up store properly when a process couldn't be registered in the engine.

Modified:
    
ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java

Modified: 
ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java
URL: 
http://svn.apache.org/viewvc/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java?view=diff&rev=565969&r1=565968&r2=565969
==============================================================================
--- 
ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java 
(original)
+++ 
ode/trunk/bpel-store/src/main/java/org/apache/ode/store/ProcessStoreImpl.java 
Tue Aug 14 16:32:26 2007
@@ -277,14 +277,21 @@
         });
 
         // We want the events to be fired outside of the bounds of the 
writelock.
-        for (ProcessConfImpl process : processes) {
-            fireEvent(new ProcessStoreEvent(ProcessStoreEvent.Type.DEPLOYED, 
process.getProcessId(), process.getDeploymentUnit()
-                    .getName()));
-            fireStateChange(process.getProcessId(), process.getState(), 
process.getDeploymentUnit().getName());
+        try {
+            for (ProcessConfImpl process : processes) {
+                fireEvent(new 
ProcessStoreEvent(ProcessStoreEvent.Type.DEPLOYED, process.getProcessId(), 
process.getDeploymentUnit()
+                        .getName()));
+                fireStateChange(process.getProcessId(), process.getState(), 
process.getDeploymentUnit().getName());
+            }
+        } catch (Exception e) {
+            // A problem at that point means that engine deployment failed, we 
don't want the store to keep the du
+            __log.warn("Deployment failed within the engine, store undeploying 
process.");
+            undeploy(deploymentUnitDirectory);
+            if (e instanceof ContextException) throw (ContextException) e;
+            else throw new ContextException("Deployment failed within the 
engine.", e);
         }
 
         return deployed;
-
     }
 
     public Collection<QName> undeploy(final File dir) {


Reply via email to