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>