From 6fb6bd3e6100189441c679c281286d5b580d2c67 Mon Sep 17 00:00:00 2001 From: Hao Chen Date: Fri, 31 Jul 2020 15:35:43 +0800 Subject: [PATCH] Refine Java "Ray Core Walkthrough" doc (#9836) --- doc/source/walkthrough.rst | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/doc/source/walkthrough.rst b/doc/source/walkthrough.rst index fe9281a8c..f73e9d619 100644 --- a/doc/source/walkthrough.rst +++ b/doc/source/walkthrough.rst @@ -10,7 +10,7 @@ This walkthrough will overview the core concepts of Ray: With Ray, your code will work on a single machine and can be easily scaled to large cluster. -Java demo code in this documentation can be found `here `__. +Java demo code in this documentation can be found `here `__. Installation ------------ @@ -113,9 +113,11 @@ Ray enables arbitrary functions to be executed asynchronously. These asynchronou // The result can be retrieved with ``ObjectRef::get``. Assert.assertTrue(res.get() == 1); - public static int slowFunction() throws InterruptedException { - TimeUnit.SECONDS.sleep(10); - return 1; + public class MyRayApp { + public static int slowFunction() throws InterruptedException { + TimeUnit.SECONDS.sleep(10); + return 1; + } } // Invocations of Ray remote functions happen in parallel. @@ -149,8 +151,10 @@ Passing object refs to remote functions .. code-tab:: java - public static int functionWithAnArgument(int value) { - return value + 1; + public class MyRayApp { + public static int functionWithAnArgument(int value) { + return value + 1; + } } ObjectRef objRef1 = Ray.task(MyRayApp::myFunction).remote();