diff --git a/java/runtime/JavaInternal.java b/java/runtime/JavaInternal.java index 2f9ac75b5..3d180300e 100644 --- a/java/runtime/JavaInternal.java +++ b/java/runtime/JavaInternal.java @@ -72,7 +72,7 @@ public class JavaInternal { /** * Run the main task. - * The maun task is executed by the thread pool so that when it blocks + * The main task is executed by the thread pool so that when it blocks * the thread pool is notified correctly. */ public static void runMain(Runnable main) diff --git a/java/runtime/MercuryRuntime.java b/java/runtime/MercuryRuntime.java index 5eaa9271d..766895058 100644 --- a/java/runtime/MercuryRuntime.java +++ b/java/runtime/MercuryRuntime.java @@ -9,7 +9,7 @@ package jmercury.runtime; /** * Interface to the Mercury Runtime System for Java code. * - * No instance of this class is ever created, all it's members and methods + * No instance of this class is ever created, all its members and methods * are static. */ public class MercuryRuntime @@ -40,7 +40,7 @@ public class MercuryRuntime } /** - * Retrive the exit status stored in the IO state. + * Retrive the exit status stored in the I/O state. */ public static int getExitStatus() { return JavaInternal.exit_status; @@ -48,8 +48,8 @@ public class MercuryRuntime /** * Finalise the runtime system. - * This _must_ be cAlled at the normal end of any program. Currently - * it runs finalisers and stops the thread pool. + * This _must_ be called at the normal end of any program. It runs + * finalisers and stops the thread pool. */ public static void finalise() { JavaInternal.run_finalisers(); diff --git a/java/runtime/MercuryThreadPool.java b/java/runtime/MercuryThreadPool.java index be121a269..0905e9a1b 100644 --- a/java/runtime/MercuryThreadPool.java +++ b/java/runtime/MercuryThreadPool.java @@ -453,7 +453,7 @@ public class MercuryThreadPool /** * Run the thread pool. - * The calling thread is used to "run" the thread pool. It's main job + * The calling thread is used to "run" the thread pool. Its main job * is to keep the correct number of worker threads alive. It does not * return until the thread pool is stopped (with a call to shutdown()). * run() is usually called by runMain(), and shutdown() is usually @@ -556,11 +556,11 @@ public class MercuryThreadPool } /** - * Start the thread pool in it's own thread. + * Start the thread pool in its own thread. * Normally the thread pool ie executed directly by the main thread. * However, when Mercury is used as a library by a native Java * application this is not true, and the thread pool runs in a thread of - * it's own. + * its own. */ public MercuryThread startup() { @@ -591,10 +591,10 @@ public class MercuryThreadPool * Request that the thread pool shutdown. * This method does not wait for the thread pool to shutdown, it's an * asychronous signal. The thread pool will shutdown if: shutdown() has - * been called (implicitly when running as an application) and there are - * no remaining tasks either queued or running (spawn_native tasks are - * not included). The requirement that the process does not exit until - * all tasks have finish is maintained by the JVM. + * been called (implicitly when main/2 is written in Mercury) and there + * are no remaining tasks either queued or running (spawn_native tasks + * are not included). The requirement that the process does not exit + * until all tasks have finish is maintained by the JVM. */ public boolean shutdown() { diff --git a/samples/java_interface/standalone_java/JavaMain.java b/samples/java_interface/standalone_java/JavaMain.java index 8cc9f3149..4f6ed3c92 100644 --- a/samples/java_interface/standalone_java/JavaMain.java +++ b/samples/java_interface/standalone_java/JavaMain.java @@ -25,14 +25,17 @@ public class JavaMain { try { runProgram(args); } finally { - // When we have finished calling Mercury procedures then we need to - // tell the Mercury Runtime that we've finished using it. - // This invokes any finalisers specified using ':- finalise' - // declarations in the set of Mercury libraries we are using. It - // also tells the thread pool to shutdown, if the thread pool is not - // runnuing then this does nothing. + // When we have finished calling Mercury procedures then we need + // to tell the Mercury Runtime that we've finished using it. // The static method finalise() in the MercuryRuntime class does - // this. + // this. This call is (currently) mandatory otherwise the JVM + // may not exit cleanly, therefore it should be called in a + // finally block as in this example. + //` + // This call will invoke any finalisers specified using + // ':- finalise' declarations in the set of Mercury libraries we + // are using. It also tells the thread pool to shutdown, if the + // thread pool is not runnuing then this does nothing. // MercuryRuntime.finalise(); diff --git a/samples/java_interface/standalone_java/Makefile b/samples/java_interface/standalone_java/Makefile index 8c3bf9427..38ac81d73 100644 --- a/samples/java_interface/standalone_java/Makefile +++ b/samples/java_interface/standalone_java/Makefile @@ -14,10 +14,10 @@ MER_JARS = $(MER_LIB_DIR)/mer_std.jar:$(MER_LIB_DIR)/mer_rt.jar .PHONY: all all: run -JavaMain.class: JavaMain.java libmercury_lib.jar +JavaMain.class: JavaMain.java mercury_lib.jar $(JAVAC) JavaMain.java -cp $(MER_JARS):Mercury/classs -d . -libmercury_lib.jar: mercury_lib.m +mercury_lib.jar: mercury_lib.m $(MMC) --grade $(GRADE) --make libmercury_lib .PHONY: run diff --git a/samples/java_interface/standalone_java/mercury_lib.m b/samples/java_interface/standalone_java/mercury_lib.m index efc52c33a..2e1f551a4 100644 --- a/samples/java_interface/standalone_java/mercury_lib.m +++ b/samples/java_interface/standalone_java/mercury_lib.m @@ -17,7 +17,7 @@ % :- func cube(int) = int. - % fibs(N) returns the Nth fibbonanci number using a parallelised naive + % fibs(N) returns the Nth Fibonacci number using a parallelised naive % algorithm. % :- func fibs(int) = int.