Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions core/src/main/java/com/findwise/hydra/StageRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.findwise.hydra.stage.GroupStarter;

public class StageRunner extends Thread {

private StageGroup stageGroup;
Expand Down Expand Up @@ -163,16 +165,11 @@ public void printJavaVersion() {
private boolean runGroup() {
CommandLine cmdLine = new CommandLine(java);
cmdLine.addArgument(jvmParameters, false);
if(classPathString==null) {
classPathString = targetDirectory.getAbsolutePath()+File.separator+"*";
} else {
classPathString = classPathString+":"+targetDirectory.getAbsolutePath()+File.separator+"*";
}
String cp = getClassPath();

cmdLine.addArgument("-cp");
cmdLine.addArgument("${classpath}");
cmdLine.addArgument("-jar");
cmdLine.addArgument("${file}");
cmdLine.addArgument(GroupStarter.class.getCanonicalName());
cmdLine.addArgument(stageGroup.getName());
cmdLine.addArgument("localhost");
cmdLine.addArgument("" + pipelinePort);
Expand All @@ -182,8 +179,7 @@ private boolean runGroup() {

HashMap<String, Object> map = new HashMap<String, Object>();

map.put("file", files.get(0)); //Any of the files should do as a starting point
map.put("classpath", classPathString);
map.put("classpath", cp);

cmdLine.setSubstitutionMap(map);
logger.info("Launching with command " + cmdLine.toString());
Expand Down Expand Up @@ -222,6 +218,22 @@ private boolean runGroup() {
return true;
}

private String getClassPath() {
if(classPathString==null) {
return getAllJars();
} else {
return classPathString+File.pathSeparator+getAllJars();
}
}

private String getAllJars() {
String jars="";
for(String s : targetDirectory.list()) {
jars+=targetDirectory.getAbsolutePath()+File.separator+s+File.pathSeparator;
}
return jars.substring(0, jars.length()-1);
}

/**
* Destroys the JVM running this stage and removes it's working files.
* Should a JVM shutdown fail, it will throw an IllegalStateException.
Expand Down