├── .gitignore
├── .travis.yml
├── LICENSE
├── README.md
├── pom.xml
└── src
├── main
└── java
│ └── io
│ └── github
│ └── avivcarmis
│ └── javared
│ ├── executor
│ ├── BaseRedSynchronizer.java
│ ├── PreconditionFailedException.java
│ ├── RedSynchronizer.java
│ └── RedVoidSynchronizer.java
│ ├── future
│ ├── BaseOpenRedFuture.java
│ ├── OpenRedFuture.java
│ ├── OpenRedFutureOf.java
│ ├── RedFuture.java
│ ├── RedFutureHub.java
│ ├── RedFutureOf.java
│ └── callbacks
│ │ ├── Callback.java
│ │ └── EmptyCallback.java
│ └── test
│ ├── RedTestContext.java
│ └── RedTestRunner.java
└── test
└── java
└── io
└── github
└── avivcarmis
└── javared
├── TestRedFuture.java
├── TestRedSynchronizer.java
└── TestRedTest.java
/.gitignore:
--------------------------------------------------------------------------------
1 | .idea/
2 | *.iml
3 | target/
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: java
2 |
3 | jdk:
4 | - oraclejdk8
5 |
6 | addons:
7 | apt:
8 | packages:
9 | - oracle-java8-installer
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Aviv C
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # JavaRed : Effective Concurrency Modules for Java
2 | [](https://github.com/avivcarmis/java-red "The Java Red Library")
3 |
4 | ------------
5 |
6 | [](https://travis-ci.org/avivcarmis/java-red "Java Red Build Status at Travis CI")
7 |
8 | The **JavaRed** library essentially introduces an effective, intuitive interface to define and manage asynchronous, concurrent [graph execution flows](https://github.com/avivcarmis/java-red/wiki/About-Graph-Execution "graph execution flows").
9 | JavaRed requires JDK 1.8 or higher.
10 |
11 | ### Latest Release
12 | ------------
13 | The most recent release is JavaRed 1.0.1, released April 6, 2017.
14 |
15 | To add a dependency on JavaRed Library using Maven, use the following:
16 | ```
17 |
18 | io.github.avivcarmis
19 | java-red
20 | 1.0.1
21 |
22 | ```
23 |
24 | To add a dependency on JavaRed Library using Gradle, use the following:
25 | ```
26 | compile 'io.github.avivcarmis:java-red:1.0.1'
27 | ```
28 |
29 | API Docs:
30 | - Latest: https://avivcarmis.github.io/java-red/apidocs/latest/
31 | - 1.0.1: https://avivcarmis.github.io/java-red/apidocs/1.0.1/
32 |
33 | ### Getting Started
34 | ------------
35 | The JavaRed Library getting start guide at Github Wiki page: https://github.com/avivcarmis/java-red/wiki
36 |
37 | ### Useful Links
38 | ------------
39 | - [The project GitHub page](https://github.com/avivcarmis/java-red "The project GitHub page")
40 | - [The project Issue Tracker on GitHub](https://github.com/avivcarmis/java-red/issues "The project Issue Tracker on GitHub")
41 | - [The project build Status at Travis CI](https://travis-ci.org/avivcarmis/java-red "The project build Status at Travis CI")
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 | com.google.guava
11 | guava
12 | 21.0
13 |
14 |
15 |
16 |
17 | junit
18 | junit
19 | 4.12
20 |
21 |
22 |
23 |
24 | 4.0.0
25 | io.github.avivcarmis
26 | java-red
27 | 1.0.1-SNAPSHOT
28 | jar
29 | ${project.groupId}:${project.artifactId}
30 | Effective Concurrency Modules for Java.
31 | https://github.com/avivcarmis/java-red
32 |
33 | GitHub Issues
34 | https://github.com/avivcarmis/java-red/issues
35 |
36 | 2017
37 |
38 |
39 | MIT License
40 | http://www.opensource.org/licenses/mit-license.php
41 |
42 |
43 |
44 | scm:git:https://github.com/avivcarmis/java-red.git
45 | scm:git:git@github.com:avivcarmis/java-red.git
46 | https://github.com/avivcarmis/java-red
47 |
48 |
49 | Travis CI
50 | https://travis-ci.org/avivcarmis/java-red
51 |
52 |
53 |
54 |
55 | Aviv Carmi
56 | avivcarmis@gmail.com
57 |
58 | owner
59 | developer
60 |
61 | +2
62 |
63 |
64 |
65 |
66 |
67 | ossrh
68 | https://oss.sonatype.org/content/repositories/snapshots
69 |
70 |
71 |
72 |
73 |
74 |
75 | org.apache.maven.plugins
76 | maven-compiler-plugin
77 | 3.5.1
78 |
79 | 1.8
80 | 1.8
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 | release
89 |
90 |
91 |
92 |
93 | org.sonatype.plugins
94 | nexus-staging-maven-plugin
95 | 1.6.8
96 | true
97 |
98 | ossrh
99 | https://oss.sonatype.org/
100 | true
101 |
102 |
103 |
104 |
105 | org.apache.maven.plugins
106 | maven-javadoc-plugin
107 | 2.10.4
108 |
109 |
110 | attach-javadocs
111 |
112 | jar
113 |
114 |
115 |
116 |
117 |
118 |
119 | org.apache.maven.plugins
120 | maven-source-plugin
121 | 2.2.1
122 |
123 |
124 | attach-sources
125 |
126 | jar-no-fork
127 |
128 |
129 |
130 |
131 |
132 |
133 | org.apache.maven.plugins
134 | maven-gpg-plugin
135 | 1.5
136 |
137 |
138 | sign-artifacts
139 | verify
140 |
141 | sign
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
--------------------------------------------------------------------------------
/src/main/java/io/github/avivcarmis/javared/executor/PreconditionFailedException.java:
--------------------------------------------------------------------------------
1 | package io.github.avivcarmis.javared.executor;
2 |
3 | /**
4 | * Represents the indication error that will be thrown in case an
5 | * execution precondition failed.
6 | */
7 | abstract public class PreconditionFailedException extends Exception {
8 |
9 | // Constructors
10 |
11 | private PreconditionFailedException(String message) {
12 | super(message);
13 | }
14 |
15 | private PreconditionFailedException(String message, Throwable cause) {
16 | super(message, cause);
17 | }
18 |
19 | // Static
20 |
21 | /**
22 | * Will be thrown in case an execution was expecting a precondition to
23 | * succeed, but failed.
24 | *
25 | * Original failure may be retrieved through {@link #getCause()}
26 | */
27 | public static class Success extends PreconditionFailedException {
28 |
29 | Success(Throwable cause) {
30 | super("expected success but failed", cause);
31 | }
32 |
33 | }
34 |
35 | /**
36 | * Will be thrown in case an execution was expecting a precondition to
37 | * fail, but succeeded.
38 | */
39 | public static class Failure extends PreconditionFailedException {
40 |
41 | private Failure() {
42 | super("expected failure but succeeded");
43 | }
44 |
45 | static final Failure INSTANCE = new Failure();
46 |
47 | }
48 |
49 | }
50 |
--------------------------------------------------------------------------------
/src/main/java/io/github/avivcarmis/javared/executor/RedSynchronizer.java:
--------------------------------------------------------------------------------
1 | package io.github.avivcarmis.javared.executor;
2 |
3 | import io.github.avivcarmis.javared.future.RedFuture;
4 | import io.github.avivcarmis.javared.future.RedFutureOf;
5 |
6 | /**
7 | * A class to implement execution of a Red Synchronizer which receive INPUT typed
8 | * inputs and returns OUTPUT typed outputs
9 | *
10 | * @param type of the input of the execution
11 | * @param