Application deployment is now performed in parallel. Order of jars in the application classpath is sorted by name
git-svn-id: https://hyracks.googlecode.com/svn/trunk@168 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java
index e8586be..212524d 100644
--- a/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java
+++ b/hyracks/hyracks-control-cc/src/main/java/edu/uci/ics/hyracks/control/cc/ClusterControllerService.java
@@ -23,6 +23,7 @@
import java.io.PrintWriter;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;
+import java.util.ArrayList;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
@@ -356,15 +357,30 @@
}
@Override
- public void startApplication(String appName) throws Exception {
+ public void startApplication(final String appName) throws Exception {
ApplicationContext appCtx = applications.get(appName);
appCtx.initialize();
- boolean deployHar = appCtx.containsHar();
+ final boolean deployHar = appCtx.containsHar();
+ RemoteOp<Void>[] ops;
synchronized (this) {
- for (NodeControllerState ncs : nodeRegistry.values()) {
- ncs.getNodeController().createApplication(appName, deployHar);
+ List<RemoteOp<Void>> opList = new ArrayList<RemoteOp<Void>>();
+ for (final String nodeId : nodeRegistry.keySet()) {
+ opList.add(new RemoteOp<Void>() {
+ @Override
+ public String getNodeId() {
+ return nodeId;
+ }
+
+ @Override
+ public Void execute(INodeController node) throws Exception {
+ node.createApplication(appName, deployHar);
+ return null;
+ }
+ });
}
+ ops = opList.toArray(new RemoteOp[opList.size()]);
}
+ runRemote(ops, null);
}
@Override
diff --git a/hyracks/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/application/ApplicationContext.java b/hyracks/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/application/ApplicationContext.java
index c1b4674..c499ac9 100644
--- a/hyracks/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/application/ApplicationContext.java
+++ b/hyracks/hyracks-control-common/src/main/java/edu/uci/ics/hyracks/control/common/application/ApplicationContext.java
@@ -26,6 +26,8 @@
import java.net.URL;
import java.net.URLClassLoader;
import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
import java.util.Enumeration;
import java.util.List;
import java.util.Properties;
@@ -73,6 +75,12 @@
File expandedFolder = getExpandedFolder();
List<URL> urls = new ArrayList<URL>();
findJarFiles(expandedFolder, urls);
+ Collections.sort(urls, new Comparator<URL>() {
+ @Override
+ public int compare(URL o1, URL o2) {
+ return o1.getFile().compareTo(o2.getFile());
+ }
+ });
classLoader = new URLClassLoader(urls.toArray(new URL[urls.size()]));
deploymentDescriptor = parseDeploymentDescriptor();
@@ -180,4 +188,4 @@
public boolean containsHar() {
return getArchiveFile().exists();
}
-}
+}
\ No newline at end of file