Libraryless. Click here for Pure Java version (359L/3K/10K).
1 | !747 |
2 | |
3 | m { |
4 | static int masterPort; |
5 | static DialogIO masterConn; |
6 | static int interval = 1000; |
7 | |
8 | p { |
9 | masterPort = parseInt(args[0]); |
10 | masterConn = talkTo("localhost", masterPort); |
11 | print("Dependent VM: Connected to master at port " + masterPort + "."); |
12 | masterConn.readLine(); |
13 | masterConn.sendLine("Master: My VM port is " + myVMPort()); |
14 | masterConn.readLine(); |
15 | while (shouldStayAlive()) |
16 | sleep(interval); |
17 | System.exit(0); |
18 | } |
19 | |
20 | static boolean shouldStayAlive() { |
21 | try { |
22 | masterConn.sendLine("Master: Should I stay alive?"); |
23 | S answer = masterConn.readLine(); |
24 | boolean yes = match3("yes", answer) || match3("yes ...", answer); |
25 | if (!yes) |
26 | print("Master said: " + answer); |
27 | return yes; |
28 | } catch (Exception e) { |
29 | e.printStackTrace(); |
30 | return false; |
31 | } |
32 | } |
33 | } |
Began life as a copy of #1001316
download show line numbers debug dex old transpilations
Travelled to 16 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, dhtvkmknsjym, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, onxytkatvevr, pyentgdyhuwx, pzhvpgtvlbxg, teubizvjbppd, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1001317 |
Snippet name: | Dependent VM |
Eternal ID of this version: | #1001317/1 |
Text MD5: | 63d1447179c9e12f07830e859ac5ffed |
Transpilation MD5: | fbdea653b4860aa6b7933f50d71dba2d |
Author: | stefan |
Category: | javax |
Type: | JavaX source code |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2015-10-09 18:22:48 |
Source code size: | 875 bytes / 33 lines |
Pitched / IR pitched: | No / Yes |
Views / Downloads: | 547 / 988 |
Referenced in: | [show references] |