Skip to content

Commit 2c52d11

Browse files
author
Tapio Rautonen
committed
iluwatar#68: Documented async method invocation.
1 parent 064aa26 commit 2c52d11

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ Concurrency patterns are those types of design patterns that deal with the multi
7171

7272
* [Double Checked Locking](#double-checked-locking)
7373
* [Thread Pool](#thread-pool)
74+
* [Async Method Invocation](#async-method-invocation)
7475

7576
### Presentation Tier Patterns
7677

@@ -618,6 +619,18 @@ validation and for building to order
618619
**Applicability:** Use the Thread Pool pattern when
619620
* You have a large number of short-lived tasks to be executed in parallel
620621

622+
## <a name="async-method-invocation">Async Method Invocation</a> [&#8593;](#list-of-design-patterns)
623+
**Intent:** Asynchronous method invocation is pattern where the calling thread is not blocked while waiting results of tasks. The pattern provides parallel processing of multiple independent tasks and retrieving the results via callbacks or waiting until everything is done.
624+
625+
**Applicability:** Use async method invocation pattern when
626+
* You have multiple independent tasks that can run in parallel
627+
* You need to improve performance of running a group of sequential tasks
628+
* You have limited number of processing capacity or long running tasks and the caller cannot wait the tasks to be ready
629+
630+
**Real world examples:**
631+
* [FutureTask](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/FutureTask.html), [CompletableFuture](https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/CompletableFuture.html) and [ExecutorService](http://docs.oracle.com/javase/8/docs/api/java/util/concurrent/ExecutorService.html) (Java)
632+
* [Task-based Asynchronous Pattern](https://msdn.microsoft.com/en-us/library/hh873175.aspx) (.NET)
633+
621634
## <a name="private-class-data">Private Class Data</a> [&#8593;](#list-of-design-patterns)
622635
**Intent:** Private Class Data design pattern seeks to reduce exposure of attributes by limiting their visibility. It reduces the number of class attributes by encapsulating them in single Data object.
623636

0 commit comments

Comments
 (0)