Skip to content

Commit d434260

Browse files
committed
Preparing release
1 parent cbf4260 commit d434260

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
[![Maven Central](https://img.shields.io/maven-central/v/net.tascalate/net.tascalate.concurrent.svg)](https://search.maven.org/artifact/net.tascalate/net.tascalate.concurrent/0.8.2/jar) [![GitHub release](https://img.shields.io/github/release/vsilaev/tascalate-concurrent.svg)](https://github.com/vsilaev/tascalate-concurrent/releases/tag/0.8.2) [![license](https://img.shields.io/github/license/vsilaev/tascalate-concurrent.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt)
1+
[![Maven Central](https://img.shields.io/maven-central/v/net.tascalate/net.tascalate.concurrent.svg)](https://search.maven.org/artifact/net.tascalate/net.tascalate.concurrent/0.8.3/jar) [![GitHub release](https://img.shields.io/github/release/vsilaev/tascalate-concurrent.svg)](https://github.com/vsilaev/tascalate-concurrent/releases/tag/0.8.3) [![license](https://img.shields.io/github/license/vsilaev/tascalate-concurrent.svg)](http://www.apache.org/licenses/LICENSE-2.0.txt)
22
# tascalate-concurrent
33
The library provides an implementation of the [CompletionStage](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletionStage.html) interface and related classes these are designed to support long-running blocking tasks (typically, I/O bound). This functionality augments the sole Java 8 built-in implementation, [CompletableFuture](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html), that is primarily supports computational tasks. Also, the library helps with numerous asynchronous programing challenges like handling timeouts, retry/poll functionality, orchestrating results of multiple concurrent computations and similar.
44

@@ -12,7 +12,7 @@ New name:
1212
<dependency>
1313
<groupId>net.tascalate</groupId>
1414
<artifactId>net.tascalate.concurrent</artifactId>
15-
<version>0.8.2</version>
15+
<version>0.8.3</version>
1616
</dependency>
1717
```
1818
Old Name
@@ -40,7 +40,7 @@ To use a library you have to add a single Maven dependency
4040
<dependency>
4141
<groupId>net.tascalate</groupId>
4242
<artifactId>net.tascalate.concurrent</artifactId>
43-
<version>0.8.2</version>
43+
<version>0.8.3</version>
4444
</dependency>
4545
```
4646
# What is inside?
@@ -538,7 +538,7 @@ Ah, those dreaded `TreadLocal`-s we all hate, love to hate, but, neveretheless,
538538

539539
Typically, we spawn asynchronous code from some thread with well-known characteristics, like HTTP request thread. Here we can easly access contextual information from thread-local variables. However, using thread-local variables from asynchronous code block is hard while it's impossible to predict what thread from the pool will execute the code. It's necessary to capture the context of the one thread and propagate it to threads executing asynchronous code.
540540

541-
To solve this issue, there Tascalate Concurrent provides `ContextVar` class, that serves as a proxy over thread-local variable for multi-threaded code. Typical usage scenario is the following:
541+
To solve this issue, there Tascalate Concurrent provides `ContextVar` class (since version 0.8.1), that serves as a proxy over thread-local variable for multi-threaded code. Typical usage scenario is the following:
542542

543543
1. Define `ContextualPromiseFactory` holding `ContextVar`-s from existing thread-local variables.
544544
2. Capture a context of the thread that spawns asynchronous operations.

src/test/java/net/tascalate/concurrent/J8Examples.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,13 +173,14 @@ public static void main(final String[] argv) throws InterruptedException, Execut
173173
}).thenAccept(System.out::println);
174174

175175
System.out.println("Intermediate result: " + intermidiate.toCompletableFuture().get());
176-
176+
177177
Promise<?> xt = CompletableTask
178-
.supplyAsync(() -> "" + awaitAndProduceN(11), executorService)
178+
.supplyAsync(() -> "" + awaitAndProduceN(10), executorService)
179179
.defaultAsyncOn(executorService)
180180
.onCancel(() -> System.out.println("CANCELLED!!!"))
181+
.exceptionallyComposeAsync(e -> CompletableTask.supplyAsync(() -> "<ERROR> " + e.getMessage(), executorService))
181182
.dependent()
182-
.onTimeout("XYZ", Duration.ofMillis(20), true, true)
183+
.onTimeout("XYZ", Duration.ofMillis(2000), true, true)
183184
.thenAccept(v -> System.out.println("Value produced via timeout: " + v))
184185
;
185186
//xt.cancel(true);

0 commit comments

Comments
 (0)