You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: overviews/core/_posts/2012-09-20-futures.md
+7-7Lines changed: 7 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -200,13 +200,13 @@ once.
200
200
Once a `Future` object is given a value or an exception, it becomes
201
201
in effect immutable-- it can never be overwritten.
202
202
203
-
The simplest way to create a future object is to invoke the `future`
203
+
The simplest way to create a future object is to invoke the `Future`
204
204
method which starts an asynchronous computation and returns a
205
205
future holding the result of that computation.
206
206
The result becomes available once the future completes.
207
207
208
208
Note that `Future[T]` is a type which denotes future objects, whereas
209
-
`future` is a method which creates and schedules an asynchronous
209
+
`Future` is a method which creates and schedules an asynchronous
210
210
computation, and then returns a future object which will be completed
211
211
with the result of that computation.
212
212
@@ -237,7 +237,7 @@ has to be sent over a network, which can take a long time.
237
237
This is illustrated with the call to the method `getFriends` that returns `List[Friend]`.
238
238
To better utilize the CPU until the response arrives, we should not
239
239
block the rest of the program-- this computation should be scheduled
240
-
asynchronously. The `future` method does exactly that-- it performs
240
+
asynchronously. The `Future` method does exactly that-- it performs
241
241
the specified computation block concurrently, in this case sending
242
242
a request to the server and waiting for a response.
243
243
@@ -246,7 +246,7 @@ responds.
246
246
247
247
An unsuccessful attempt may result in an exception. In
248
248
the following example, the `session` value is incorrectly
249
-
initialized, so the computation in the `future` block will throw a `NullPointerException`.
249
+
initialized, so the computation in the `Future` block will throw a `NullPointerException`.
250
250
This future `f` is then failed with this exception instead of being completed successfully:
251
251
252
252
val session = null
@@ -258,9 +258,9 @@ The line `import ExecutionContext.Implicits.global` above imports
258
258
the default global execution context.
259
259
Execution contexts execute tasks submitted to them, and
260
260
you can think of execution contexts as thread pools.
261
-
They are essential for the `future` method because
261
+
They are essential for the `Future` method because
262
262
they handle how and when the asynchronous computation is executed.
263
-
You can define your own execution contexts and use them with `future`,
263
+
You can define
7C5B
your own execution contexts and use them with `Future`,
264
264
but for now it is sufficient to know that
265
265
you can import the default execution context as shown above.
266
266
@@ -749,7 +749,7 @@ the throwable types it matches.
749
749
-->
750
750
751
751
<!--
752
-
Invoking the `future` construct uses a global execution context to start an asynchronous computation. In the case the client desires to use a custom execution context to start an asynchronous computation:
752
+
Invoking the `Future` construct uses a global execution context to start an asynchronous computation. In the case the client desires to use a custom execution context to start an asynchronous computation:
0 commit comments