Permalink
Browse files

two-step shell protocol handshake

  • Loading branch information...
1 parent b76c41b commit a71b3024cdf326e6166114d739c9f6413564fc28 @tomjack tomjack committed Mar 29, 2012
Showing with 4 additions and 11 deletions.
  1. +2 −7 src/jvm/backtype/storm/utils/ShellProcess.java
  2. +1 −2 src/multilang/py/storm.py
  3. +1 −2 src/multilang/rb/storm.rb
@@ -29,18 +29,13 @@ public Number launch(Map conf, TopologyContext context) throws IOException {
processIn = new DataOutputStream(_subprocess.getOutputStream());
processOut = new BufferedReader(new InputStreamReader(_subprocess.getInputStream()));
- JSONObject pidDir = new JSONObject();
- pidDir.put("pidDir", context.getPIDDir());
- writeMessage(pidDir);
-
- Number pid = (Number)readMessage().get("pid");
-
JSONObject setupInfo = new JSONObject();
+ setupInfo.put("pidDir", context.getPIDDir());
setupInfo.put("conf", conf);
setupInfo.put("context", context);
writeMessage(setupInfo);
- return pid;
+ return (Number)readMessage().get("pid");
}
public void destroy() {
@@ -116,9 +116,8 @@ def log(msg):
sendMsgToParent({"command": "log", "msg": msg})
def initComponent():
- heartbeatdir = readMsg()['pidDir']
- sendpid(heartbeatdir)
setupInfo = readMsg()
+ sendpid(setupInfo['pidDir'])
return [setupInfo['conf'], setupInfo['context']]
class Tuple:
@@ -107,9 +107,8 @@ def log(msg)
end
def handshake
- heartbeat_dir = read_message['pidDir']
- send_pid heartbeat_dir
setup_info = read_message
+ send_pid setup_info['pidDir']
[setup_info['conf'], setup_info['context']]
end
end

0 comments on commit a71b302

Please sign in to comment.