|
1 | 1 | # 1.7.7 |
2 | 2 |
|
3 | | -This entire release is focused on `AsyncCallback`. |
| 3 | +This entire release is new features around `AsyncCallback`. |
4 | 4 |
|
5 | | -* `AsyncCallback` instances: |
| 5 | +<br> |
6 | 6 |
|
7 | | - * Added `fork` and `fork_` which run the async computation in the background. |
| 7 | +## `AsyncCallback` instances |
8 | 8 |
|
9 | | - The result of `fork` gives you access to `await: AsyncCallback[A], isComplete: CallbackTo[Boolean]` which you can |
10 | | - use to join back up with it again later. |
| 9 | +* Added `.fork` and `.fork_` which run the async computation in the background. |
11 | 10 |
|
12 | | - `fork_` on the other hand, returns nothing and is effectively fire-and-forget. |
| 11 | + The result of `fork` gives you access to `(await: AsyncCallback[A], isComplete: CallbackTo[Boolean])` which you can |
| 12 | + use to join back up with it again later. |
13 | 13 |
|
14 | | - * Added duration measuring methods that exist on `Callback`: |
| 14 | + `fork_` on the other hand, returns nothing and is effectively fire-and-forget. |
15 | 15 |
|
16 | | - ```scala |
17 | | - def withDuration[B](f: (A, FiniteDuration) => AsyncCallback[B]): AsyncCallback[B] |
18 | | - def logDuration (fmt: FiniteDuration => String) : AsyncCallback[A] |
19 | | - def logDuration (name: String) : AsyncCallback[A] |
20 | | - def logDuration : AsyncCallback[A] |
21 | | - ``` |
| 16 | +* Added duration measuring methods that exist on `Callback`: |
22 | 17 |
|
23 | | -* `AsyncCallback` object: |
| 18 | + ```scala |
| 19 | + def withDuration[B](f: (A, FiniteDuration) => AsyncCallback[B]): AsyncCallback[B] |
| 20 | + def logDuration (fmt: FiniteDuration => String) : AsyncCallback[A] |
| 21 | + def logDuration (name: String) : AsyncCallback[A] |
| 22 | + def logDuration : AsyncCallback[A] |
| 23 | + ``` |
24 | 24 |
|
25 | | - * Added `def awaitAll(as: AsyncCallback[_]*): AsyncCallback[Unit]` to wait for a number of async processes to complete. |
| 25 | +<br> |
26 | 26 |
|
27 | | - * Added `countDownLatch(count: Int)` which returns an `AsyncCallback.CountDownLatch`. |
28 | | - It has the same purpose and semantics as Java's `CountDownLatch`. |
| 27 | +## `AsyncCallback` object |
29 | 28 |
|
30 | | - ```scala |
31 | | - AsyncCallback.CountDownLatch { |
32 | | - countDown : Callback |
33 | | - await : AsyncCallback[Unit] |
34 | | - isComplete: CallbackTo[Boolean] |
35 | | - pending : CallbackTo[Int] |
36 | | - } |
37 | | - ``` |
| 29 | +* Added `def awaitAll(as: AsyncCallback[_]*): AsyncCallback[Unit]` to wait for a number of async processes to complete. |
38 | 30 |
|
39 | | - * Added `mutex` which returns a `AsyncCallback.Mutex`: |
| 31 | +* Added `.countDownLatch(count: Int)` which returns an `AsyncCallback.CountDownLatch`. |
| 32 | + It has the same purpose and semantics as Java's `CountDownLatch`. |
40 | 33 |
|
41 | | - ```scala |
42 | | - AsyncCallback.Mutex { |
43 | | - /** Wrap a AsyncCallback so that it executes in the mutex. |
44 | | - * |
45 | | - * Note: THIS IS NOT RE-ENTRANT. Calling this from within the mutex will block. |
46 | | - */ |
47 | | - def apply[A](ac: AsyncCallback[A]): AsyncCallback[A] |
48 | | - } |
49 | | - ``` |
| 34 | + ```scala |
| 35 | + AsyncCallback.CountDownLatch { |
| 36 | + val countDown : Callback |
| 37 | + val await : AsyncCallback[Unit] |
| 38 | + val isComplete: CallbackTo[Boolean] |
| 39 | + val pending : CallbackTo[Int] |
| 40 | + } |
| 41 | + ``` |
50 | 42 |
|
51 | | - * Added `readWriteMutex` which returns a `AsyncCallback.ReadWriteMutex`: |
| 43 | +* Added `.mutex` which returns a `AsyncCallback.Mutex`: |
52 | 44 |
|
53 | | - ```scala |
54 | | - AsyncCallback.ReadWriteMutex { |
| 45 | + ```scala |
| 46 | + AsyncCallback.Mutex { |
55 | 47 |
|
56 | | - /** Wrap a AsyncCallback so that it executes in the write-mutex. |
57 | | - * There can only be one writer active at one time. |
58 | | - * |
59 | | - * Note: THIS IS NOT RE-ENTRANT. Calling this from within the read or write mutex will block. |
60 | | - */ |
61 | | - def write[A](ac: AsyncCallback[A]): AsyncCallback[A] |
| 48 | + /** Wrap a AsyncCallback so that it executes in the mutex. |
| 49 | + * |
| 50 | + * Note: THIS IS NOT RE-ENTRANT. Calling this from within the mutex will block. |
| 51 | + */ |
| 52 | + def apply[A](ac: AsyncCallback[A]): AsyncCallback[A] |
| 53 | + } |
| 54 | + ``` |
62 | 55 |
|
63 | | - /** Wrap a AsyncCallback so that it executes in the read-mutex. |
64 | | - * There can be many readers active at one time. |
65 | | - * |
66 | | - * Note: Calling this from within the write-mutex will block. |
67 | | - */ |
68 | | - def read[A](ac: AsyncCallback[A]): AsyncCallback[A] |
69 | | - } |
70 | | - ``` |
| 56 | +* Added `.readWriteMutex` which returns a `AsyncCallback.ReadWriteMutex`: |
71 | 57 |
|
72 | | - * Added `ref[A](allowStaleReads = false, atomicWrites = true)` which returns a `AsyncCallback.Ref`. |
73 | | - A ref is effectively a "wrapper" for mutable variable. By default, setters and getters are atomic. |
| 58 | + ```scala |
| 59 | + AsyncCallback.ReadWriteMutex { |
74 | 60 |
|
75 | | - ```scala |
76 | | - AsyncCallback.Ref[A] { |
77 | | - val get : AsyncCallback[A] |
78 | | - val getIfAvailable: CallbackTo[Option[A]] |
| 61 | + /** Wrap a AsyncCallback so that it executes in the write-mutex. |
| 62 | + * There can only be one writer active at one time. |
| 63 | + * |
| 64 | + * Note: THIS IS NOT RE-ENTRANT. Calling this from within the read or write mutex will block. |
| 65 | + */ |
| 66 | + def write[A](ac: AsyncCallback[A]): AsyncCallback[A] |
79 | 67 |
|
80 | | - def set (a: => A) : AsyncCallback[Unit] |
81 | | - def setSync (c: CallbackTo[A]) : AsyncCallback[Unit] |
82 | | - def setAsync(c: AsyncCallback[A]): AsyncCallback[Unit] |
| 68 | + /** Wrap a AsyncCallback so that it executes in the read-mutex. |
| 69 | + * There can be many readers active at one time. |
| 70 | + * |
| 71 | + * Note: Calling this from within the write-mutex will block. |
| 72 | + */ |
| 73 | + def read[A](ac: AsyncCallback[A]): AsyncCallback[A] |
| 74 | + } |
| 75 | + ``` |
83 | 76 |
|
84 | | - def setIfUnset (a: => A) : AsyncCallback[Boolean] |
85 | | - def setIfUnsetSync (c: CallbackTo[A]) : AsyncCallback[Boolean] |
86 | | - def setIfUnsetAsync(c: AsyncCallback[A]): AsyncCallback[Boolean] |
87 | | - } |
88 | | - ``` |
| 77 | +* Added `ref[A](allowStaleReads = false, atomicWrites = true)` which returns a `AsyncCallback.Ref`. |
| 78 | + A ref is effectively a "wrapper" for mutable variable. By default, setters and getters are atomic. |
89 | 79 |
|
90 | | - * You can now add a `_` suffix to the following to return an `AsyncCallback[Unit]` and be more efficient under-the-hood: |
| 80 | + ```scala |
| 81 | + AsyncCallback.Ref[A] { |
| 82 | + val get : AsyncCallback[A] |
| 83 | + val getIfAvailable: CallbackTo[Option[A]] |
91 | 84 |
|
92 | | - * `traverse` |
93 | | - * `sequence` |
94 | | - * `traverseOption` |
95 | | - * `sequenceOption` |
| 85 | + def set (a: => A) : AsyncCallback[Unit] |
| 86 | + def setSync (c: CallbackTo[A]) : AsyncCallback[Unit] |
| 87 | + def setAsync(c: AsyncCallback[A]): AsyncCallback[Unit] |
96 | 88 |
|
97 | | - * The argument to `throwException` is now by-name |
| 89 | + def setIfUnset (a: => A) : AsyncCallback[Boolean] |
| 90 | + def setIfUnsetSync (c: CallbackTo[A]) : AsyncCallback[Boolean] |
| 91 | + def setIfUnsetAsync(c: AsyncCallback[A]): AsyncCallback[Boolean] |
| 92 | + } |
| 93 | + ``` |
98 | 94 |
|
99 | | - * Added `def throwExceptionWhenDefined(o: => Option[Throwable]): AsyncCallback[Unit]` |
| 95 | +* You can now add a `_` suffix to the following to return an `AsyncCallback[Unit]` and be more efficient under-the-hood: |
100 | 96 |
|
101 | | -* `AsyncCallback.Barrier`: |
| 97 | + * `.traverse` |
| 98 | + * `.sequence` |
| 99 | + * `.traverseOption` |
| 100 | + * `.sequenceOption` |
102 | 101 |
|
103 | | - * Added `isComplete: CallbackTo[Boolean]` to synchronously query whether the barrier is complete or not. |
| 102 | +* The argument to `.throwException` is now by-name |
104 | 103 |
|
105 | | - * Renamed `waitForCompletion` to `await`. |
106 | | - `waitForCompletion` is still available but will result in a deprecation warning. |
107 | | - Automatic migration is below. |
| 104 | +* Added `def throwExceptionWhenDefined(o: => Option[Throwable]): AsyncCallback[Unit]` |
108 | 105 |
|
| 106 | +<br> |
| 107 | + |
| 108 | +## `AsyncCallback.Barrier` |
| 109 | + |
| 110 | +* Added `isComplete: CallbackTo[Boolean]` to synchronously query whether the barrier is complete or not. |
| 111 | + |
| 112 | +* Renamed `waitForCompletion` to `await`. |
| 113 | + |
| 114 | + `waitForCompletion` is still available but will result in a deprecation warning. |
| 115 | + Automatic migration is below. |
| 116 | + |
| 117 | + |
| 118 | +<br> |
109 | 119 |
|
110 | 120 | ## Migration |
111 | 121 |
|
|
0 commit comments