File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed
main/java/com/iluwatar/halfsynchalfasync
test/java/com/iluwatar/halfsynchalfasync Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change 33import java .util .concurrent .LinkedBlockingQueue ;
44
55/**
6+ *
67 * This application demonstrates Half-Sync/Half-Async pattern. Key parts of the pattern are
78 * {@link AsyncTask} and {@link AsynchronousService}.
89 *
4445 * Such as Priority Queue can be used as queuing layer to prioritize the way tasks are executed.
4546 * Our implementation is just one simple way of implementing this pattern, there are many variants possible
4647 * as described in its applications.
48+ *
4749 */
4850public class App {
4951
52+ /**
53+ * Program entry point
54+ * @param args command line args
55+ */
5056 public static void main (String [] args ) {
5157 AsynchronousService service = new AsynchronousService (new LinkedBlockingQueue <>());
5258 /*
@@ -66,6 +72,11 @@ public static void main(String[] args) {
6672 service .execute (new ArithmeticSumTask (1 ));
6773 }
6874
75+ /**
76+ *
77+ * ArithmeticSumTask
78+ *
79+ */
6980 static class ArithmeticSumTask implements AsyncTask <Long > {
7081 private long n ;
7182
Original file line number Diff line number Diff line change 44
55import org .junit .Test ;
66
7+ /**
8+ *
9+ * Application test
10+ *
11+ */
712public class AppTest {
813
914 @ Test
You can’t perform that action at this time.
0 commit comments