July 12th, 2024

Java Structured Concurrency Is More Than ShutdownOnFailure

Java 21 introduces structured concurrency for managing parallel sub-tasks within specific scopes. EnhancedTaskScope offers features like throttling, circuit breakers, default values on failure, and Critical tasks identification. ListTaskScope aids list conversions. Custom features can be added for extended functionality. StructuredTaskScope executes tasks in virtual threads efficiently.

Read original articleLink Icon
Java Structured Concurrency Is More Than ShutdownOnFailure

Since Java 21, structured concurrency has been introduced as a preview feature, allowing the management of parallel sub-tasks within a specific scope. While examples often showcase ShutdownOnSuccess and ShutdownOnFailure classes, the Virtually project extends these capabilities. EnhancedTaskScope offers features like throttling to control task execution, a circuit breaker to halt tasks on consecutive failures, and the ability to provide default values on failure. Additionally, Critical tasks can be identified within the scope, and ListTaskScope facilitates list conversions with added functionalities. These scopes can be further extended for custom features like throttling based on keys or incorporating logging and monitoring. StructuredTaskScope serves as a foundation for executing multiple tasks in virtual threads, providing a flexible and powerful tool for managing concurrent tasks effectively.

Related

Continuations by Example

Continuations by Example

Continuations are powerful in control-flow constructs, enabling exceptions, search, threads, generators, and coroutines. They capture remaining computation steps, aiding in non-deterministic choices and efficient iteration over data structures.

Rust FSM-based Resumable Postgres tasks

Rust FSM-based Resumable Postgres tasks

The "pg_task" project on GitHub manages FSM-based Resumable Postgres tasks. It features granular state machines, error handling, single-table task scheduling, task definition, execution, stopping, and updating guidelines. Licensed under MIT.

Properly Testing Concurrent Data Structures

Properly Testing Concurrent Data Structures

The article explores testing concurrent data structures using the Rust library loom. It demonstrates creating property tests with managed threads to simulate concurrent behavior, emphasizing synchronization challenges and design considerations.

Solving Concurrency Bugs Using Schedules and Imagination

Solving Concurrency Bugs Using Schedules and Imagination

Ankush Menat highlights challenges of concurrency bugs in business apps, stresses importance of addressing them. He introduces schedule diagrams as a visual debugging tool, offering a practical approach to identify and resolve concurrency issues efficiently. Menat demonstrates the effectiveness of schedule diagrams through examples, urging developers to leverage them for debugging.

An introduction to Jorvik, Ada's new tasking profile

An introduction to Jorvik, Ada's new tasking profile

AdaCore introduced Jorvik in Ada 2022, a tasking profile enhancing expressive power for real-time and embedded applications. Jorvik relaxes restrictions compared to Ravenscar, allowing more complex Boolean expressions and multiple callers on protected entries. This new profile enables classic protected type idioms and concurrent bounded buffers, complementing Ravenscar's focus on high-integrity systems. Jorvik offers additional flexibility while maintaining compatibility with Ravenscar.

Link Icon 0 comments