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 8c71c6e  2026/03/29 05:48:26: Generated dev website from 
groovy-website@7b99ea4
8c71c6e is described below

commit 8c71c6e3e58c95ea08751e3a7161227205f3b163
Author: jenkins <[email protected]>
AuthorDate: Sun Mar 29 05:48:26 2026 +0000

    2026/03/29 05:48:26: Generated dev website from groovy-website@7b99ea4
---
 blog/groovy-async-await.html | 26 +++++++++++++++++++++-----
 search/search-index.json     |  2 +-
 2 files changed, 22 insertions(+), 6 deletions(-)

diff --git a/blog/groovy-async-await.html b/blog/groovy-async-await.html
index dfc5bf6..ec01568 100644
--- a/blog/groovy-async-await.html
+++ b/blog/groovy-async-await.html
@@ -59,7 +59,7 @@
                                     </ul>
                                 </div>
                             </div>
-                        </div><div id='content' class='page-1'><div 
class='row'><div class='row-fluid'><div class='col-lg-3'><ul 
class='nav-sidebar'><li><a href='./'>Blog index</a></li><li class='active'><a 
href='#doc'>Async/await for Groovy&trade;</a></li><li><a href='#_introduction' 
class='anchor-link'>Introduction</a></li><li><a 
href='#_choosing_the_right_tool' class='anchor-link'>Choosing the right 
tool</a></li><li><a href='#_the_problem_callback_complexity' 
class='anchor-link'>The p [...]
+                        </div><div id='content' class='page-1'><div 
class='row'><div class='row-fluid'><div class='col-lg-3'><ul 
class='nav-sidebar'><li><a href='./'>Blog index</a></li><li class='active'><a 
href='#doc'>Async/await for Groovy&trade;</a></li><li><a href='#_introduction' 
class='anchor-link'>Introduction</a></li><li><a 
href='#_choosing_the_right_tool' class='anchor-link'>Choosing the right 
tool</a></li><li><a href='#_the_problem_callback_complexity' 
class='anchor-link'>The p [...]
 <a href="https://github.com/paulk-asert/"; target="_blank" rel="noopener 
noreferrer"><img style="border-radius:50%;height:48px;width:auto" 
src="img/paulk-asert.png" alt="Paul King"></a>
 <div style="display:grid;align-items:center;margin:0.1ex;padding:0ex">
   <div><a href="https://github.com/paulk-asert/"; target="_blank" rel="noopener 
noreferrer"><span>Paul King</span></a></div>
@@ -260,8 +260,7 @@ common pattern. Here&#8217;s how it looks with 
<code>Awaitable.all</code>:</p>
     var inventory = async { fetchInventory(heroId) }
     var villain   = async { fetchVillain(visibleVillainId) }
 
-    var result = await Awaitable.all(stats(), inventory(), villain())
-    var (s, inv, v) = result*.get()  // spread the results into variables
+    var (s, inv, v) = await Awaitable.all(stats(), inventory(), villain())
     return new BattleScreen(s, inv, v)
 }</code></pre>
 </div>
@@ -298,7 +297,24 @@ syntactic sugar (<code>await</code>, <code>all</code>) and 
integrates with the s
 <code>async</code>/<code>await</code> model used everywhere else, whereas 
Java&#8217;s API
 is deliberately lower-level and imperative. We&#8217;ll see more on
 how Groovy&#8217;s <code>AsyncScope</code> complements JDK structured 
concurrency
-in <a 
href="#_example_6_the_raid_party_structured_concurrency_with_asyncscope">Example
 6</a>.</p>
+in <a href="#_example_6_the_raid_party">Example 6</a>.</p>
+</div>
+<div class="paragraph">
+<p>Note that this isn&#8217;t an exact equivalent of our Groovy example.
+The async factory-like closures are reusable. To more closely mirror
+the Java version we could use <code>Awaitable.go</code>:</p>
+</div>
+<div class="listingblock">
+<div class="content">
+<pre class="prettyprint highlight"><code data-lang="groovy">async 
prepareBattle(heroId, visibleVillainId) {
+    var stats     = Awaitable.go { fetchHeroStats(heroId) }
+    var inventory = Awaitable.go { fetchInventory(heroId) }
+    var villain   = Awaitable.go { fetchVillain(visibleVillainId) }
+
+    await Awaitable.all(stats, inventory, villain)
+    return new BattleScreen(stats.get(), inventory.get(), villain.get())
+}</code></pre>
+</div>
 </div>
 </div>
 </div>
@@ -435,7 +451,7 @@ role to Go&#8217;s <code>select</code> statement.</p>
 </div>
 </div>
 <div class="sect1">
-<h2 
id="_example_6_the_raid_party_structured_concurrency_with_asyncscope">Example 
6: the raid party — structured concurrency with <code>AsyncScope</code></h2>
+<h2 id="_example_6_the_raid_party">Example 6: the raid party — structured 
concurrency with <code>AsyncScope</code></h2>
 <div class="sectionbody">
 <div class="paragraph">
 <p>A raid sends multiple heroes to scout different dungeon rooms
diff --git a/search/search-index.json b/search/search-index.json
index e0b125d..f2bd8de 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&trade;",
-        "content": "The Apache Groovy programming language - Blogs - 
Async/await for Groovy&trade; 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&trade; Learn Documentation Download 
Support Contribute Ecosystem Blog post [...]
+        "content": "The Apache Groovy programming language - Blogs - 
Async/await for Groovy&trade; 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&trade; Learn Documentation Download 
Support Contribute Ecosystem Blog post [...]
         "url": "blog/groovy-async-await.html",
         "site": "dev"
     },

Reply via email to