Skip to content

Commit

Permalink
remove ATTR_WAIT_CHILD and make postlaunch return Process
Browse files Browse the repository at this point in the history
If caplet does not want to wait on the child, it should return null
from postlaunch
  • Loading branch information
pron committed Feb 23, 2015
1 parent 48a0eb4 commit 756eae6
Showing 1 changed file with 10 additions and 15 deletions.
25 changes: 10 additions & 15 deletions capsule/src/main/java/Capsule.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@ public class Capsule implements Runnable {
"A list of native JVMTI agents used by the application; formatted \"agent\" or \"agent=arg1,arg2...\", where agent is either the path to a native library, without the platform-specific suffix, relative to the capsule root. The native library file(s) can be embedded in the capsule or listed as Maven native dependencies using the Native-Dependencies-... attributes.");
protected static final Entry<String, List<String>> ATTR_DEPENDENCIES = ATTRIBUTE("Dependencies", T_LIST(T_STRING()), null, true, "A list of Maven dependencies given as groupId:artifactId:version[(excludeGroupId:excludeArtifactId,...)]");
protected static final Entry<String, Map<String, String>> ATTR_NATIVE_DEPENDENCIES = ATTRIBUTE("Native-Dependencies", T_MAP(T_STRING(), ""), null, true, "A list of Maven dependencies consisting of native library artifacts; each item can be a comma separated pair, with the second component being a new name to give the download artifact");
protected static final Entry<String, Boolean> ATTR_WAIT_CHILD = ATTRIBUTE("Wait-Child", T_BOOL(), true, true, "Whether or not the capsule process should await the termination of the child (application) process");

// outgoing
private static final String VAR_CAPSULE_APP = "CAPSULE_APP";
Expand Down Expand Up @@ -1109,19 +1108,17 @@ private int launch(List<String> args) throws IOException, InterruptedException {
pb.inheritIO();

oc.child = pb.start();
oc.child = postlaunch(oc.child);

final int pid = getPid(oc.child);
if (pid > 0)
System.setProperty(PROP_CAPSULE_APP_PID, Integer.toString(pid));
if (oc.child != null) {
final int pid = getPid(oc.child);
if (pid > 0)
System.setProperty(PROP_CAPSULE_APP_PID, Integer.toString(pid));

postlaunch(oc.child);

if (getAttribute(ATTR_WAIT_CHILD)) {
if (isInheritIoBug())
pipeIoStreams();
oc.child.waitFor();
} else
oc.child = null;
}
}

return oc.child != null ? oc.child.exitValue() : 0;
Expand Down Expand Up @@ -1361,14 +1358,12 @@ private static boolean isTrampoline() {
*
* @param child the child process running the application
*/
protected void postlaunch(Process child) {
if ((_ct = getCallTarget(Capsule.class)) != null)
_ct.postlaunch(child);
else
postlaunch0(child);
protected Process postlaunch(Process child) {
return ((_ct = getCallTarget(Capsule.class)) != null) ? _ct.postlaunch(child) : postlaunch0(child);
}

private void postlaunch0(Process child) {
private Process postlaunch0(Process child) {
return child;
}
//</editor-fold>

Expand Down

0 comments on commit 756eae6

Please sign in to comment.