You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by xu...@apache.org on 2011/09/20 09:03:08 UTC
svn commit: r1173000 -
/geronimo/server/branches/2.1/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
Author: xuhaihong
Date: Tue Sep 20 07:03:07 2011
New Revision: 1173000
URL: http://svn.apache.org/viewvc?rev=1173000&view=rev
Log:
GERONIMO-5265 Modify the redeploy behavior to start all the running childs along with the parent (Based on the patch from Ashish Jain)
Modified:
geronimo/server/branches/2.1/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
Modified: geronimo/server/branches/2.1/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java?rev=1173000&r1=1172999&r2=1173000&view=diff
==============================================================================
--- geronimo/server/branches/2.1/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java (original)
+++ geronimo/server/branches/2.1/framework/modules/geronimo-deploy-jsr88/src/main/java/org/apache/geronimo/deployment/plugin/local/RedeployCommand.java Tue Sep 20 07:03:07 2011
@@ -18,10 +18,12 @@ package org.apache.geronimo.deployment.p
import java.io.File;
import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.Iterator;
+import java.util.List;
import javax.enterprise.deploy.shared.CommandType;
-import javax.enterprise.deploy.shared.ModuleType;
import javax.enterprise.deploy.spi.Target;
import javax.enterprise.deploy.spi.TargetModuleID;
@@ -33,6 +35,7 @@ import org.apache.geronimo.kernel.Intern
import org.apache.geronimo.kernel.Kernel;
import org.apache.geronimo.kernel.config.ConfigurationManager;
import org.apache.geronimo.kernel.config.ConfigurationUtil;
+import org.apache.geronimo.kernel.config.LifecycleException;
import org.apache.geronimo.kernel.config.LifecycleResults;
import org.apache.geronimo.kernel.config.NoSuchConfigException;
import org.apache.geronimo.kernel.repository.Artifact;
@@ -174,8 +177,11 @@ public class RedeployCommand extends Abs
if(!configID.isResolved()) {
throw new IllegalStateException("Cannot redeploy same module when module ID is not fully resolved ("+configID+")");
}
+ List<Artifact> startedChildren = Collections.<Artifact>emptyList();
try {
- configurationManager.stopConfiguration(configID);
+ LifecycleResults lifecycleResults = configurationManager.stopConfiguration(configID);
+ startedChildren = new ArrayList<Artifact>(lifecycleResults.getStopped());
+ Collections.reverse(startedChildren);
updateStatus("Stopped "+configID);
} catch (InternalKernelException e) {
Exception cause = (Exception)e.getCause();
@@ -228,5 +234,20 @@ public class RedeployCommand extends Abs
configurationManager.loadConfiguration(configID);
configurationManager.startConfiguration(configID);
updateStatus("Started " + configID);
+
+ for (Artifact startedArtifactId : startedChildren) {
+ if(startedArtifactId.equals(configID)) {
+ continue;
+ }
+ try {
+ configurationManager.loadConfiguration(startedArtifactId);
+ configurationManager.startConfiguration(startedArtifactId);
+ updateStatus("Restarted Chid " + startedArtifactId);
+ } catch (NoSuchConfigException e) {
+ updateStatus("Restart Chid Failed " + startedArtifactId);
+ } catch (LifecycleException e) {
+ updateStatus("Restarted Chid Failed " + startedArtifactId);
+ }
+ }
}
}