Simple-React 0.95 发布,Java 并发流库
Simple-React 0.95 发布,SimpleReact 为 Java 8 增加了高级异步 Streams 和数据结构。这是一个 Java 8 的并发流库,提供三中 Stream 类型(LazyFutureStream、SimpleReactStream、EagerFutureStream)和三种异步数据结构(Queue、 Topic、Signal)。
流类型:
该版本主要改进包括:
LazyFutureStream 增强
-
Backed by a non-blocking wait free queue by default
-
Collect /forEach / reduce all start fully asyncrhonous & parallel LazyFutureStreams in the same manner as Run (previously they would only allow one active chain of Futures at a time)
接口增强
创建方法遵循以下常规:
-
of: data for immediate consumption
-
react: data for asynchronous consumption
List<Data> result = LazyFutureStream.of(1,2,3,4) .map(this:process) .run(Collectors.toList()); List<Data> result = EagerFutureStream.react(this::loadData1,this::loadData2,this::loadData3) .map(this:process) .toList();
Interface 清理
1.0 版本很快发布,接口更加稳定
其他改进
-
Lombok removed as an runtime dependency
-
Guava replaced with lighterweight pcollections (simple-react-0.95-all.jar is ~400k)
-
Accept Executor rather than ExecutorService
-
Cyclops Monad comprehenders for use with Cyclops for comprehensions and Monad wrapper
-
compile group: 'com.aol.simplereact', name:'simple-react', version:'0.95'
Adding simple-react as a Dependency
Gradle
Maven
<dependency> <groupId>com.aol.simplereact</groupId> <artifactId>simple-react</artifactId> <version>0.95</version> <scope>compile</scope> </dependency>