Strands provides structured concurrency for Java using virtual threads, reducing the syntactic overhead of traditional asynchronous frameworks.
Note
Strands requires Java 25 or higher.
Important
This is not an officially supported Google product. This project is not eligible for the Google Open Source Software Vulnerability Rewards Program.
Strands simplifies asynchronous Java programming by leveraging virtual threads to write sequential-style code that executes concurrently. It provides structured concurrency primitives (such as scopes, tasks, and gatherers) to manage complex concurrency graphs reliably and safely.
Strands provides the following core capabilities:
- Structured Concurrency: Manage task lifetimes and cancellation within well-defined scopes.
- Virtual Thread Integration: Eliminate nested callbacks and Future chains using Java 25+ Virtual Threads.
- Fluent Gathering and Composition: Collect, compose, and transform results across multiple asynchronous tasks.
See the docs directory for the following guides:
- Overview and Getting Started: Introduction, code examples, and benefits.
- Concepts: Scopes, structured concurrency, context propagation, and the Strand lifecycle.
- Failures: Fail-fast defaults,
Result<T>functional error handling, and combinators. - Early Termination: Cancellation, timeouts, and interruption handling.
- Gatherers: Stream gatherer integration and concurrent streaming pipelines.
- Interoperability: Bridges to
ListenableFuture, standardFuture, and functional interfaces. - Style Guide: Idiomatic usage patterns, best practices, and anti-patterns.
- Testing: Synchronous testing with
StrandsRuleand@InStrand. - Roadmap: Planned features, architectural goals, and JDK tracking.
Access project resources and report issues using the following links:
- GitHub Repository: View the source code and release notes.
- Issue Tracker: Report a defect or feature request.
See CONTRIBUTING and CODE_OF_CONDUCT for details on how to contribute to Strands.
See SECURITY for details on how to report security issues.
The Apache 2.0 License governs Strands. See the LICENSE file for details.