File tree Expand file tree Collapse file tree 5 files changed +10
-10
lines changed Expand file tree Collapse file tree 5 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -88,9 +88,10 @@ import mylib.foo.Bar
88
88
Scalive uses the [ Attach API] ( https://blogs.oracle.com/CoreJavaTechTips/entry/the_attach_api ) in Java 6
89
89
to tell the target process to load an [ agent] ( http://javahowto.blogspot.jp/2006/07/javaagent-option.html ) .
90
90
91
- The agent then creates a REPL interpreter and a TCP server to let the
92
- Scalive process interact with the interpreter remotely. The Scalive
93
- process acts as a client.
91
+ Inside the target progress, the agent creates a REPL interpreter and a
92
+ TCP server to let the Scalive process connect and interact with the
93
+ interpreter. The Scalive process acts as a TCP client. There are 2 TCP
94
+ connections, one for REPL data and one for completion data.
94
95
95
96
Similar projects:
96
97
Original file line number Diff line number Diff line change 11
11
12
12
public class Net {
13
13
// After this time, the REPL and completer connections should be closed,
14
- // to avoid blocking socket reads to infinitely block threads created by Scalive in remote process
14
+ // to avoid blocking socket reads to infinitely block threads created by Scalive in target process
15
15
private static final int LONG_INACTIVITY = (int ) TimeUnit .HOURS .toMillis (1 );
16
16
17
17
public static final InetAddress LOCALHOST = getLocalHostAddress ();
@@ -25,7 +25,7 @@ public static int getLocalFreePort() throws Exception {
25
25
26
26
/**
27
27
* {@link SocketTimeoutException} will be thrown if there's no activity for a long time.
28
- * This is to avoid blocking reads to block threads infinitely, causing leaks in the remote process.
28
+ * This is to avoid blocking reads to block threads infinitely, causing leaks in the target process.
29
29
*/
30
30
public static void throwSocketTimeoutExceptionForLongInactivity (Socket socket ) throws SocketException {
31
31
socket .setSoTimeout (LONG_INACTIVITY );
Original file line number Diff line number Diff line change 9
9
10
10
class Client {
11
11
static void run (int port ) throws Exception {
12
- Log .log ("Attach to remote process at port " + port );
12
+ Log .log ("Attach to target process at port " + port );
13
13
final Socket replSocket = new Socket (Net .LOCALHOST , port );
14
14
final Socket completerSocket = new Socket (Net .LOCALHOST , port );
15
15
16
- // Try to notify the remote process to clean up when the client is terminated
16
+ // Try to notify the target process to clean up when the client is terminated
17
17
final Runnable socketCleaner = Net .getSocketCleaner (replSocket , completerSocket );
18
18
Runtime .getRuntime ().addShutdownHook (new Thread (Client .class .getName () + "-ShutdownHook" ) {
19
19
@ Override
Original file line number Diff line number Diff line change @@ -65,8 +65,7 @@ private static void printServerOutput(InputStream in) throws UnsupportedEncoding
65
65
System .out .flush ();
66
66
}
67
67
68
- // The loop above is broken when REPL is closed by the remote process;
69
- // exit now
68
+ // The loop above is broken when REPL is closed by the target process; exit now
70
69
System .exit (0 );
71
70
}
72
71
}
Original file line number Diff line number Diff line change @@ -63,7 +63,7 @@ static void run(
63
63
64
64
socketCleaner .run ();
65
65
66
- // Before logging this out, wait a litte for System.out to be restored back to the remote process
66
+ // Before logging this out, wait a litte for System.out to be restored back to the target process
67
67
Thread .sleep (1000 );
68
68
Log .log ("Completer closed" );
69
69
}
You can’t perform that action at this time.
0 commit comments