GROOVY-12033: groovy.concurrent.Actor: pre-GA hardening — Stop sentin…#2555
Draft
paulk-asert wants to merge 1 commit into
Draft
GROOVY-12033: groovy.concurrent.Actor: pre-GA hardening — Stop sentin…#2555paulk-asert wants to merge 1 commit into
paulk-asert wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2555 +/- ##
==================================================
+ Coverage 68.1904% 68.2085% +0.0181%
- Complexity 33103 33140 +37
==================================================
Files 1508 1509 +1
Lines 126157 126257 +100
Branches 22891 22903 +12
==================================================
+ Hits 86027 86118 +91
- Misses 32490 32498 +8
- Partials 7640 7641 +1
🚀 New features to boost your workflow:
|
Comment on lines
217
to
219
| Envelope<T> envelope = queue.take(); | ||
| if (envelope.message == POISON) return; | ||
|
|
Comment on lines
+190
to
+194
| try { | ||
| queue.put(envelope); | ||
| } catch (InterruptedException ie) { | ||
| Thread.currentThread().interrupt(); | ||
| throw new RuntimeException("Interrupted while sending to actor", ie); |
Comment on lines
+135
to
+137
| * To stop the actor from inside an error handler, call | ||
| * {@link Actor#currentSelf() Actor.<T>currentSelf().stop()}, or use | ||
| * the context-aware overload {@link #onError(TriConsumer)}. |
Comment on lines
85
to
93
| * asynchronously. Fire-and-forget — no reply is expected. | ||
| * | ||
| * @param message the message to send | ||
| * @throws IllegalStateException if the actor has been stopped | ||
| * @throws IllegalStateException if the actor has been stopped, or if | ||
| * the mailbox is bounded with {@link ActorOptions.Overflow#FAIL} | ||
| * and is full | ||
| */ | ||
| void send(T message); | ||
|
|
Comment on lines
+455
to
+457
| actor.send('first') // taken by the handler, which blocks on hold | ||
| started.await() // 'first' is off the queue when this returns | ||
| actor.send('a') // queued (1/2) |
Comment on lines
+484
to
+486
| actor.send('first') // currently being processed | ||
| started.await() | ||
| actor.send('a') // queued (1/2) |
Comment on lines
+510
to
+512
| actor.send('busy') // occupies the handler | ||
| started.await() | ||
| actor.send('queued') // fills the 1-slot queue |
| def actor = Actor.reactor({ msg -> started.countDown(); hold.await(); msg }, options) | ||
|
|
||
| actor.send('first') // being processed | ||
| started.await() |
Comment on lines
+309
to
+312
| def actor = Actor.stateful(0) { ActorContext ctx, int seen, Integer msg -> | ||
| gate.await() | ||
| log << msg | ||
| if (msg == 2) ctx.self().stop() |
Comment on lines
+336
to
+339
| def actor = Actor.stateful(100) { ActorContext ctx, int state, msg -> | ||
| gate.await() | ||
| if (msg == 'stop') { ctx.self().stop(); return state } | ||
| state + 1 |
…el, error callback, bounded mailbox, per-actor pool
✅ All tests passed ✅🏷️ Commit: 39f80c1 Learn more about TestLens at testlens.app. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…el, error callback, bounded mailbox, per-actor pool