Skip to content

Commit

Permalink
expt
Browse files Browse the repository at this point in the history
  • Loading branch information
oldratlee committed Jan 27, 2025
1 parent 3895147 commit 3ab9ba8
Show file tree
Hide file tree
Showing 14 changed files with 51 additions and 51 deletions.
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<a href="https://openjdk.java.net/"><img src="https://img.shields.io/badge/Java-8+-339933?logo=openjdk&logoColor=white" alt="Java support"></a>
<a href="https://www.apache.org/licenses/LICENSE-2.0.html"><img src="https://img.shields.io/github/license/foldright/cffu?color=4D7A97&logo=apache" alt="License"></a>
<a href="https://foldright.io/api-docs/cffu/"><img src="https://img.shields.io/github/release/foldright/cffu?label=javadoc&color=339933&logo=read-the-docs&logoColor=white" alt="Javadocs"></a>
<a href="https://central.sonatype.com/artifact/io.foldright/cffu/1.0.0/versions"><img src="https://img.shields.io/maven-central/v/io.foldright/cffu?logo=apache-maven&logoColor=white" alt="Maven Central"></a>
<a href="https://central.sonatype.com/artifact/io.foldright/cffu/0.7.0/versions"><img src="https://img.shields.io/maven-central/v/io.foldright/cffu?logo=apache-maven&logoColor=white" alt="Maven Central"></a>
<a href="https://github.com/foldright/cffu/releases"><img src="https://img.shields.io/github/release/foldright/cffu.svg" alt="GitHub Releases"></a>
<a href="https://github.com/foldright/cffu/stargazers"><img src="https://img.shields.io/github/stars/foldright/cffu?style=flat" alt="GitHub Stars"></a>
<a href="https://github.com/foldright/cffu/fork"><img src="https://img.shields.io/github/forks/foldright/cffu?style=flat" alt="GitHub Forks"></a>
Expand Down Expand Up @@ -165,18 +165,18 @@
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu</artifactId>
<version>1.0.0</version>
<version>0.7.0</version>
</dependency>
```
- For `Gradle` projects:

Gradle Kotlin DSL
```groovy
implementation("io.foldright:cffu:1.0.0")
implementation("io.foldright:cffu:0.7.0")
```
Gradle Groovy DSL
```groovy
implementation 'io.foldright:cffu:1.0.0'
implementation 'io.foldright:cffu:0.7.0'
```

> `cffu`也支持`Kotlin`扩展方法的使用方式,参见[`cffu-kotlin/README.md`](cffu-kotlin/README.md);使用方式的对比示例参见[`docs/usage-mode-demo.md`](docs/usage-mode-demo.md)
Expand All @@ -196,7 +196,7 @@
- 或是在传入的`CompletableFuture Action`中设置外部的变量,需要注意多线程读写的线程安全问题 ⚠️
- 多线程读写涉及多线程数据传递的复杂性,遗漏并发逻辑的数据读写的正确处理是业务代码中的常见问题❗️
- 并发深坑勿入,并发逻辑复杂易出Bug 🐞
如果涉及超时则会更复杂,`JDK CompletableFuture`自身在`Java 21`中也有这方面的[Bug修复](https://github.com/foldright/cffu/releases/tag/v1.0.0-Alpha20)
如果涉及超时则会更复杂,`JDK CompletableFuture`自身在`Java 21`中也有这方面的[Bug修复](https://github.com/foldright/cffu/releases/tag/v0.7.0-Alpha20)

`cffu``allResultsFailFastOf` / `allResultsOf` / `mostSuccessResultsOf`等方法提供了返回多个`CF`运行结果的功能。使用这些方法获取多个`CF`的整体运行结果:

Expand Down Expand Up @@ -513,16 +513,16 @@ public class MultipleActionsDemo {
- 业务功能的正确性问题
- 系统稳定性问题,如导致线程中等待操作不能返回、耗尽线程池

`cffu`提供了超时执行安全的新实现方法 [`cffuOrTimeout()`](https://foldright.io/api-docs/cffu/1.0.0/io/foldright/cffu/CompletableFutureUtils.html#cffuOrTimeout(C,long,java.util.concurrent.TimeUnit))
/ [`cffuCompleteOnTimeout()`](https://foldright.io/api-docs/cffu/1.0.0/io/foldright/cffu/CompletableFutureUtils.html#cffuCompleteOnTimeout(C,T,long,java.util.concurrent.TimeUnit))
`cffu`提供了超时执行安全的新实现方法 [`cffuOrTimeout()`](https://foldright.io/api-docs/cffu/0.7.0/io/foldright/cffu/CompletableFutureUtils.html#cffuOrTimeout(C,long,java.util.concurrent.TimeUnit))
/ [`cffuCompleteOnTimeout()`](https://foldright.io/api-docs/cffu/0.7.0/io/foldright/cffu/CompletableFutureUtils.html#cffuCompleteOnTimeout(C,T,long,java.util.concurrent.TimeUnit))


更多说明参见:

- 演示问题的[`DelayDysfunctionDemo.java`](https://github.com/foldright/cffu/blob/main/cffu-core/src/test/java/io/foldright/demo/CfDelayDysfunctionDemo.java)
- `cffu backport`方法的`JavaDoc`
- [`orTimeout()`](https://foldright.io/api-docs/cffu/1.0.0/io/foldright/cffu/CompletableFutureUtils.html#orTimeout(C,long,java.util.concurrent.TimeUnit))
- [`completeOnTimeout()`](https://foldright.io/api-docs/cffu/1.0.0/io/foldright/cffu/CompletableFutureUtils.html#completeOnTimeout(C,T,long,java.util.concurrent.TimeUnit))
- [`orTimeout()`](https://foldright.io/api-docs/cffu/0.7.0/io/foldright/cffu/CompletableFutureUtils.html#orTimeout(C,long,java.util.concurrent.TimeUnit))
- [`completeOnTimeout()`](https://foldright.io/api-docs/cffu/0.7.0/io/foldright/cffu/CompletableFutureUtils.html#completeOnTimeout(C,T,long,java.util.concurrent.TimeUnit))

### 2.7 支持超时的`join`的方法

Expand Down Expand Up @@ -580,7 +580,7 @@ public class MultipleActionsDemo {

# 🍪依赖

> 可以在 [central.sonatype.com](https://central.sonatype.com/artifact/io.foldright/cffu/1.0.0/versions) 查看最新版本与可用版本列表。
> 可以在 [central.sonatype.com](https://central.sonatype.com/artifact/io.foldright/cffu/0.7.0/versions) 查看最新版本与可用版本列表。
- `cffu`库(包含[`Java CompletableFuture`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/CompletableFuture.html)的增强`CompletableFutureUtils`):
- For `Maven` projects:
Expand All @@ -589,18 +589,18 @@ public class MultipleActionsDemo {
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu</artifactId>
<version>1.0.0</version>
<version>0.7.0</version>
</dependency>
```
- For `Gradle` projects:

Gradle Kotlin DSL
```groovy
implementation("io.foldright:cffu:1.0.0")
implementation("io.foldright:cffu:0.7.0")
```
Gradle Groovy DSL
```groovy
implementation 'io.foldright:cffu:1.0.0'
implementation 'io.foldright:cffu:0.7.0'
```
- [📌 `TransmittableThreadLocal(TTL)`](https://github.com/alibaba/transmittable-thread-local)的[`cffu executor wrapper SPI`实现](cffu-ttl-executor-wrapper):
- For `Maven` projects:
Expand All @@ -609,19 +609,19 @@ public class MultipleActionsDemo {
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu-ttl-executor-wrapper</artifactId>
<version>1.0.0</version>
<version>0.7.0</version>
<scope>runtime</scope>
</dependency>
```
- For `Gradle` projects:

Gradle Kotlin DSL
```groovy
runtimeOnly("io.foldright:cffu-ttl-executor-wrapper:1.0.0")
runtimeOnly("io.foldright:cffu-ttl-executor-wrapper:0.7.0")
```
Gradle Groovy DSL
```groovy
runtimeOnly 'io.foldright:cffu-ttl-executor-wrapper:1.0.0'
runtimeOnly 'io.foldright:cffu-ttl-executor-wrapper:0.7.0'
```
- `cffu bom`:
- For `Maven` projects:
Expand All @@ -630,7 +630,7 @@ public class MultipleActionsDemo {
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu-bom</artifactId>
<version>1.0.0</version>
<version>0.7.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -639,11 +639,11 @@ public class MultipleActionsDemo {

Gradle Kotlin DSL
```groovy
implementation(platform("io.foldright:cffu-bom:1.0.0"))
implementation(platform("io.foldright:cffu-bom:0.7.0"))
```
Gradle Groovy DSL
```groovy
implementation platform('io.foldright:cffu-bom:1.0.0')
implementation platform('io.foldright:cffu-bom:0.7.0')
```

# 📚 更多资料
Expand Down
16 changes: 8 additions & 8 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<a href="https://www.apache.org/licenses/LICENSE-2.0.html"><img src="https://img.shields.io/github/license/foldright/cffu?color=4D7A97&logo=apache" alt="License"></a>
<a href="https://foldright.io/api-docs/cffu/"><img src="https://img.shields.io/github/release/foldright/cffu?label=javadoc&color=339933&logo=read-the-docs&logoColor=white" alt="Javadocs"></a>
<a href="https://foldright.io/api-docs/cffu-kotlin/"><img src="https://img.shields.io/github/release/foldright/cffu?label=dokka&color=339933&logo=kotlin&logoColor=white" alt="dokka"></a>
<a href="https://central.sonatype.com/artifact/io.foldright/cffu/1.0.0/versions"><img src="https://img.shields.io/maven-central/v/io.foldright/cffu?logo=apache-maven&logoColor=white" alt="Maven Central"></a>
<a href="https://central.sonatype.com/artifact/io.foldright/cffu/0.7.0/versions"><img src="https://img.shields.io/maven-central/v/io.foldright/cffu?logo=apache-maven&logoColor=white" alt="Maven Central"></a>
<a href="https://github.com/foldright/cffu/releases"><img src="https://img.shields.io/github/release/foldright/cffu.svg" alt="GitHub Releases"></a>
<a href="https://github.com/foldright/cffu/stargazers"><img src="https://img.shields.io/github/stars/foldright/cffu?style=flat" alt="GitHub Stars"></a>
<a href="https://github.com/foldright/cffu/fork"><img src="https://img.shields.io/github/forks/foldright/cffu?style=flat" alt="GitHub Forks"></a>
Expand Down Expand Up @@ -596,7 +596,7 @@ Current version of `Java API` documentation: https://foldright.io/api-docs/cffu/

# 🍪Dependencies

> check out [central.sonatype.com](https://central.sonatype.com/artifact/io.foldright/cffu/1.0.0/versions) for new or available versions。
> check out [central.sonatype.com](https://central.sonatype.com/artifact/io.foldright/cffu/0.7.0/versions) for new or available versions。
- `cffu`library(including[`Java CompletableFuture`](https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/concurrent/CompletableFuture.html) enhanced `CompletableFutureUtils`):
- For `Maven` projects:
Expand All @@ -605,18 +605,18 @@ Current version of `Java API` documentation: https://foldright.io/api-docs/cffu/
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu</artifactId>
<version>1.0.0</version>
<version>0.7.0</version>
</dependency>
```
- For `Gradle` projects:

Gradle Kotlin DSL
```groovy
implementation("io.foldright:cffu:1.0.0")
implementation("io.foldright:cffu:0.7.0")
```
Gradle Groovy DSL
```groovy
implementation 'io.foldright:cffu:1.0.0'
implementation 'io.foldright:cffu:0.7.0'
```
- [📌 `TransmittableThreadLocal(TTL)`](https://github.com/alibaba/transmittable-thread-local) implementation for [`cffu executor wrapper SPI`](cffu-ttl-executor-wrapper):
- For `Maven` projects:
Expand All @@ -625,19 +625,19 @@ Current version of `Java API` documentation: https://foldright.io/api-docs/cffu/
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu-ttl-executor-wrapper</artifactId>
<version>1.0.0</version>
<version>0.7.0</version>
<scope>runtime</scope>
</dependency>
```
- For `Gradle` projects:

Gradle Kotlin DSL
```groovy
runtimeOnly("io.foldright:cffu-ttl-executor-wrapper:1.0.0")
runtimeOnly("io.foldright:cffu-ttl-executor-wrapper:0.7.0")
```
Gradle Groovy DSL
```groovy
runtimeOnly 'io.foldright:cffu-ttl-executor-wrapper:1.0.0'
runtimeOnly 'io.foldright:cffu-ttl-executor-wrapper:0.7.0'
```

# 📚 See also
Expand Down
2 changes: 1 addition & 1 deletion cffu-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
-->
<groupId>io.foldright</groupId>
<artifactId>cffu-bom</artifactId>
<version>1.x-SNAPSHOT</version>
<version>0.7.0</version>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<description>cffu bom</description>
Expand Down
2 changes: 1 addition & 1 deletion cffu-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.foldright</groupId>
<artifactId>cffu-parent</artifactId>
<version>1.x-SNAPSHOT</version>
<version>0.7.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
8 changes: 4 additions & 4 deletions cffu-kotlin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<p align="center">
<a href="https://kotlinlang.org"><img src="https://img.shields.io/badge/Kotlin-1.6+-7F52FF.svg?logo=kotlin&logoColor=white" alt="Kotlin"></a>
<a href="https://central.sonatype.com/artifact/io.foldright/cffu-kotlin/1.0.0-Alpha/versions"><img src="https://img.shields.io/maven-central/v/io.foldright/cffu-kotlin?logo=apache-maven&logoColor=white" alt="Maven Central"></a>
<a href="https://central.sonatype.com/artifact/io.foldright/cffu-kotlin/0.7.0-Alpha/versions"><img src="https://img.shields.io/maven-central/v/io.foldright/cffu-kotlin?logo=apache-maven&logoColor=white" alt="Maven Central"></a>
<a href="https://foldright.io/api-docs/cffu-kotlin/"><img src="https://img.shields.io/maven-central/v/io.foldright/cffu-kotlin?label=dokka&logo=kotlin&logoColor=white" alt="dokka"></a>
</p>

Expand All @@ -22,16 +22,16 @@ This module provides the extension methods to leverage Kotlin language.
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu-kotlin</artifactId>
<version>1.0.0-Alpha</version>
<version>0.7.0-Alpha</version>
</dependency>
```
- For `Gradle` projects:

Gradle Kotlin DSL
```groovy
implementation("io.foldright:cffu-kotlin:1.0.0-Alpha")
implementation("io.foldright:cffu-kotlin:0.7.0-Alpha")
```
Gradle Groovy DSL
```groovy
implementation 'io.foldright:cffu-kotlin:1.0.0-Alpha'
implementation 'io.foldright:cffu-kotlin:0.7.0-Alpha'
```
4 changes: 2 additions & 2 deletions cffu-kotlin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<parent>
<groupId>io.foldright</groupId>
<artifactId>cffu-parent</artifactId>
<version>1.x-SNAPSHOT</version>
<version>0.7.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>cffu-kotlin</artifactId>
<!-- UPDATE to Alpha version WHEN RELEASE, e.g. <version>1.x.y-Alpha</version> -->
<version>0.7.0-Alpha</version>
<name>${project.artifactId}</name>
<description>Cffu Kotlin Support</description>
<url>https://github.com/foldright/cffu</url>
Expand Down
8 changes: 4 additions & 4 deletions cffu-listenable-future/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Guava ListenableFuture Integration with CompletableFuture

<p align="center">
<a href="https://central.sonatype.com/artifact/io.foldright/cffu-listenable-future/1.0.0-Alpha/versions"><img src="https://img.shields.io/maven-central/v/io.foldright/cffu-listenable-future?logo=apache-maven&logoColor=white" alt="Maven Central"></a>
<a href="https://central.sonatype.com/artifact/io.foldright/cffu-listenable-future/0.7.0-Alpha/versions"><img src="https://img.shields.io/maven-central/v/io.foldright/cffu-listenable-future?logo=apache-maven&logoColor=white" alt="Maven Central"></a>
<a href="https://foldright.io/api-docs/cffu/"><img src="https://img.shields.io/maven-central/v/io.foldright/cffu-listenable-future?label=javadoc&logo=read-the-docs&logoColor=white" alt="Javadocs"></a>
</p>

Expand All @@ -18,16 +18,16 @@
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu-listenable-future</artifactId>
<version>1.0.0-Alpha</version>
<version>0.7.0-Alpha</version>
</dependency>
```
- For `Gradle` projects:

Gradle Kotlin DSL
```groovy
implementation("io.foldright:cffu-listenable-future:1.0.0-Alpha")
implementation("io.foldright:cffu-listenable-future:0.7.0-Alpha")
```
Gradle Groovy DSL
```groovy
implementation 'io.foldright:cffu-listenable-future:1.0.0-Alpha'
implementation 'io.foldright:cffu-listenable-future:0.7.0-Alpha'
```
4 changes: 2 additions & 2 deletions cffu-listenable-future/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<parent>
<groupId>io.foldright</groupId>
<artifactId>cffu-parent</artifactId>
<version>1.x-SNAPSHOT</version>
<version>0.7.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>cffu-listenable-future</artifactId>
<!-- UPDATE to Alpha version WHEN RELEASE, e.g. <version>1.x.y-Alpha</version> -->
<version>0.7.0-Alpha</version>
<name>Guava ListenableFuture Integration with CF</name>
<description>${project.name}</description>
<url>https://github.com/foldright/cffu</url>
Expand Down
8 changes: 4 additions & 4 deletions cffu-ttl-executor-wrapper/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 🦝 `Cffu` executor wrapper provider SPI implementation for TTL

<p align="center">
<a href="https://central.sonatype.com/artifact/io.foldright/cffu-ttl-executor-wrapper/1.0.0/versions"><img src="https://img.shields.io/maven-central/v/io.foldright/cffu-ttl-executor-wrapper?logo=apache-maven&logoColor=white" alt="Maven Central"></a>
<a href="https://central.sonatype.com/artifact/io.foldright/cffu-ttl-executor-wrapper/0.7.0/versions"><img src="https://img.shields.io/maven-central/v/io.foldright/cffu-ttl-executor-wrapper?logo=apache-maven&logoColor=white" alt="Maven Central"></a>
<a href="https://foldright.io/api-docs/cffu/"><img src="https://img.shields.io/maven-central/v/io.foldright/cffu-ttl-executor-wrapper?label=javadoc&logo=read-the-docs&logoColor=white" alt="Javadocs"></a>
</p>

Expand All @@ -23,18 +23,18 @@ This dependency should only be used at `Runtime`.
<groupId>io.foldright</groupId>
<artifactId>cffu-ttl-executor-wrapper</artifactId>
<scope>runtime</scope>
<version>1.0.0</version>
<version>0.7.0</version>
</dependency>
```
- For `Gradle` projects:

Gradle Kotlin DSL
```groovy
runtimeOnly("io.foldright:cffu-ttl-executor-wrapper:1.0.0")
runtimeOnly("io.foldright:cffu-ttl-executor-wrapper:0.7.0")
```
Gradle Groovy DSL
```groovy
runtimeOnly 'io.foldright:cffu-ttl-executor-wrapper:1.0.0'
runtimeOnly 'io.foldright:cffu-ttl-executor-wrapper:0.7.0'
```

`cffu-ttl-executor-wrapper` has published to maven central, find the latest version at
Expand Down
2 changes: 1 addition & 1 deletion cffu-ttl-executor-wrapper/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.foldright</groupId>
<artifactId>cffu-parent</artifactId>
<version>1.x-SNAPSHOT</version>
<version>0.7.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
2 changes: 1 addition & 1 deletion demos/cffu-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.foldright.cffu-demos</groupId>
<artifactId>demos-parent</artifactId>
<version>1.x-SNAPSHOT</version>
<version>0.7.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand Down
4 changes: 2 additions & 2 deletions demos/cffu-kotlin-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>io.foldright.cffu-demos</groupId>
<artifactId>demos-parent</artifactId>
<version>1.x-SNAPSHOT</version>
<version>0.7.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

Expand All @@ -19,7 +19,7 @@
<dependency>
<groupId>io.foldright</groupId>
<artifactId>cffu-kotlin</artifactId>
<!-- UPDATE to Alpha version WHEN RELEASE, e.g. <version>1.x.y-Alpha</version> -->
<version>0.7.0-Alpha</version>
</dependency>
<dependency>
<groupId>org.jetbrains.kotlin</groupId>
Expand Down
2 changes: 1 addition & 1 deletion demos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.foldright.cffu-demos</groupId>
<artifactId>demos-parent</artifactId>
<version>1.x-SNAPSHOT</version>
<version>0.7.0</version>
<packaging>pom</packaging>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>io.foldright</groupId>
<artifactId>cffu-parent</artifactId>
<version>1.x-SNAPSHOT</version>
<version>0.7.0</version>
<packaging>pom</packaging>
<name>${project.artifactId}</name>
<description>cffu parent</description>
Expand Down

0 comments on commit 3ab9ba8

Please sign in to comment.