This is an automated email from the ASF dual-hosted git repository.
git-site-role pushed a commit to branch asf-site
in repository https://gitbox.apache.org/repos/asf/groovy-dev-site.git
The following commit(s) were added to refs/heads/asf-site by this push:
new 91ab404 2026/03/26 03:38:19: Generated dev website from
groovy-website@8b15e16
91ab404 is described below
commit 91ab4049b1ae64bc694c3bc7082246d271fbab18
Author: jenkins <[email protected]>
AuthorDate: Thu Mar 26 03:38:19 2026 +0000
2026/03/26 03:38:19: Generated dev website from groovy-website@8b15e16
---
blog/groovy-async-await.html | 26 +++++++++++++++-----------
search/search-index.json | 2 +-
2 files changed, 16 insertions(+), 12 deletions(-)
diff --git a/blog/groovy-async-await.html b/blog/groovy-async-await.html
index 0fad9d0..012c34e 100644
--- a/blog/groovy-async-await.html
+++ b/blog/groovy-async-await.html
@@ -227,12 +227,13 @@ common pattern. Here’s how it looks with
<code>Awaitable.all</code>:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="prettyprint highlight"><code data-lang="groovy">async def
prepareBattle(heroId, visibleVillainId) {
+<pre class="prettyprint highlight"><code data-lang="groovy">async
prepareBattle(heroId, visibleVillainId) {
var stats = async { fetchHeroStats(heroId) }
var inventory = async { fetchInventory(heroId) }
var villain = async { fetchVillain(visibleVillainId) }
- var (s, inv, v) = await Awaitable.all(stats(), inventory(), villain())
+ var result = await Awaitable.all(stats(), inventory(), villain())
+ var (s, inv, v) = result*.get()
return new BattleScreen(s, inv, v)
}</code></pre>
</div>
@@ -293,7 +294,7 @@ them as they arrive. This is a natural fit for <em>async
streams</em>:
}
}
-async def runDungeon(hero, dungeonId) {
+async runDungeon(hero, dungeonId) {
for await (wave in generateWaves(dungeonId)) {
wave.each { villain -> hero.fight(villain) }
}
@@ -328,7 +329,7 @@ blocks execute in LIFO order, exactly like
</div>
<div class="listingblock">
<div class="content">
-<pre class="prettyprint highlight"><code data-lang="groovy">async def
enterDungeon(hero, dungeonId) {
+<pre class="prettyprint highlight"><code data-lang="groovy">async
enterDungeon(hero, dungeonId) {
var familiar = hero.summonFamiliar()
defer { familiar.dismiss() }
@@ -375,7 +376,7 @@ channels inspired by Go:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="prettyprint highlight"><code data-lang="groovy">async def
bossFight(hero, bossArena) {
+<pre class="prettyprint highlight"><code data-lang="groovy">async
bossFight(hero, bossArena) {
var enemies = AsyncChannel.create(3) // buffered channel
// Villain spawner — runs concurrently
@@ -417,7 +418,7 @@ completed or been cancelled:</p>
</div>
<div class="listingblock">
<div class="content">
-<pre class="prettyprint highlight"><code data-lang="groovy">async def
raidDungeon(List<Hero> party, List<Room> rooms) {
+<pre class="prettyprint highlight"><code data-lang="groovy">async
raidDungeon(List<Hero> party, List<Room> rooms) {
AsyncScope.withScope { scope ->
var missions = unique(party, rooms).collect { hero, room ->
scope.async { await hero.scout(room) }
@@ -485,20 +486,23 @@ principle: structured concurrency is the safety net, and
keyword natively understands <code>CompletableFuture</code>,
<code>CompletionStage</code>, <code>Future</code>, and
<code>Flow.Publisher</code>. For third-party
frameworks, drop-in adapter modules are auto-discovered via
-<code>ServiceLoader</code>:</p>
+<code>ServiceLoader</code>.</p>
+</div>
+<div class="paragraph">
+<p>Here, heroes might asynchronously gain boosts in power (<em>buff</em>), and
we might be able to stream villain alerts from a dungeon’s alert feed.
With the appropriate adapters on the classpath, we can <code>await</code>
Reactor’s <code>Mono</code> and <code>Flux</code> or RxJava’s
<code>Single</code> and <code>Observable</code> directly:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="prettyprint highlight"><code data-lang="groovy">// With
groovy-reactor on the classpath:
-async def heroBuffs(heroId) {
+async heroBoosts(heroId) {
var hero = await Mono.just(fetchHero(heroId))
- for await (buff in Flux.from(hero.activeBuffStream())) {
- hero.applyBuff(buff)
+ for await (boost in Flux.from(hero.activeBoostStream())) {
+ hero.applyBoost(boost)
}
}
// With groovy-rxjava on the classpath:
-async def villainAlerts(dungeonId) {
+async villainAlerts(dungeonId) {
var dungeon = await Single.just(loadDungeon(dungeonId))
for await (alert in Observable.from(dungeon.alertFeed())) {
broadcastToParty(alert)
diff --git a/search/search-index.json b/search/search-index.json
index e3a9262..29c827f 100644
--- a/search/search-index.json
+++ b/search/search-index.json
@@ -254,7 +254,7 @@
{
"id": "blog/groovy-async-await.html",
"title": "The Apache Groovy programming language - Blogs - Async/await
for Groovy",
- "content": "The Apache Groovy programming language - Blogs -
Async/await for Groovy Socialize Discuss on the mailing list Groovy on X Groovy
on Bluesky Groovy on Mastodon Groovy on LinkedIn Events and conferences Source
code on GitHub Report issues in Jira Stack Overflow questions Slack Community
You are using an outdated browser. Please upgrade your browser to improve your
experience. Apache Groovy™ Learn Documentation Download Support
Contribute Ecosystem Blog posts Socia [...]
+ "content": "The Apache Groovy programming language - Blogs -
Async/await for Groovy Socialize Discuss on the mailing list Groovy on X Groovy
on Bluesky Groovy on Mastodon Groovy on LinkedIn Events and conferences Source
code on GitHub Report issues in Jira Stack Overflow questions Slack Community
You are using an outdated browser. Please upgrade your browser to improve your
experience. Apache Groovy™ Learn Documentation Download Support
Contribute Ecosystem Blog posts Socia [...]
"url": "blog/groovy-async-await.html",
"site": "dev"
},