diff --git a/README.md b/README.md index 81d0d63..265157f 100644 --- a/README.md +++ b/README.md @@ -88,9 +88,10 @@ import mylib.foo.Bar Scalive uses the [Attach API](https://blogs.oracle.com/CoreJavaTechTips/entry/the_attach_api) in Java 6 to tell the target process to load an [agent](http://javahowto.blogspot.jp/2006/07/javaagent-option.html). -The agent then creates a REPL interpreter and a TCP server to let the -Scalive process interact with the interpreter remotely. The Scalive -process acts as a client. +Inside the target progress, the agent creates a REPL interpreter and a +TCP server to let the Scalive process connect and interact with the +interpreter. The Scalive process acts as a TCP client. There are 2 TCP +connections, one for REPL data and one for completion data. Similar projects: diff --git a/src/main/java/scalive/Net.java b/src/main/java/scalive/Net.java index fec94f6..2ec173b 100644 --- a/src/main/java/scalive/Net.java +++ b/src/main/java/scalive/Net.java @@ -11,7 +11,7 @@ public class Net { // After this time, the REPL and completer connections should be closed, - // to avoid blocking socket reads to infinitely block threads created by Scalive in remote process + // to avoid blocking socket reads to infinitely block threads created by Scalive in target process private static final int LONG_INACTIVITY = (int) TimeUnit.HOURS.toMillis(1); public static final InetAddress LOCALHOST = getLocalHostAddress(); @@ -25,7 +25,7 @@ public static int getLocalFreePort() throws Exception { /** * {@link SocketTimeoutException} will be thrown if there's no activity for a long time. - * This is to avoid blocking reads to block threads infinitely, causing leaks in the remote process. + * This is to avoid blocking reads to block threads infinitely, causing leaks in the target process. */ public static void throwSocketTimeoutExceptionForLongInactivity(Socket socket) throws SocketException { socket.setSoTimeout(LONG_INACTIVITY); diff --git a/src/main/java/scalive/client/Client.java b/src/main/java/scalive/client/Client.java index 7779869..cbf201c 100644 --- a/src/main/java/scalive/client/Client.java +++ b/src/main/java/scalive/client/Client.java @@ -9,11 +9,11 @@ class Client { static void run(int port) throws Exception { - Log.log("Attach to remote process at port " + port); + Log.log("Attach to target process at port " + port); final Socket replSocket = new Socket(Net.LOCALHOST, port); final Socket completerSocket = new Socket(Net.LOCALHOST, port); - // Try to notify the remote process to clean up when the client is terminated + // Try to notify the target process to clean up when the client is terminated final Runnable socketCleaner = Net.getSocketCleaner(replSocket, completerSocket); Runtime.getRuntime().addShutdownHook(new Thread(Client.class.getName() + "-ShutdownHook") { @Override diff --git a/src/main/java/scalive/client/Repl.java b/src/main/java/scalive/client/Repl.java index e6d54a3..a839cc3 100644 --- a/src/main/java/scalive/client/Repl.java +++ b/src/main/java/scalive/client/Repl.java @@ -65,8 +65,7 @@ private static void printServerOutput(InputStream in) throws UnsupportedEncoding System.out.flush(); } - // The loop above is broken when REPL is closed by the remote process; - // exit now + // The loop above is broken when REPL is closed by the target process; exit now System.exit(0); } } diff --git a/src/main/java/scalive/server/Completer.java b/src/main/java/scalive/server/Completer.java index 19c7195..fe7dbdc 100644 --- a/src/main/java/scalive/server/Completer.java +++ b/src/main/java/scalive/server/Completer.java @@ -63,7 +63,7 @@ static void run( socketCleaner.run(); - // Before logging this out, wait a litte for System.out to be restored back to the remote process + // Before logging this out, wait a litte for System.out to be restored back to the target process Thread.sleep(1000); Log.log("Completer closed"); }