You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -422,6 +422,9 @@ Behavioral patterns are concerned with algorithms and the assignment of responsi
422
422
**Applicability:** Use the Callback pattern when
423
423
* When some arbitrary synchronous or asynchronous action must be performed after execution of some defined activity.
424
424
425
+
**Real world examples:**
426
+
*[CyclicBarrier] (http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CyclicBarrier.html#CyclicBarrier%28int,%20java.lang.Runnable%29) constructor can accept callback that will be triggered every time when barrier is tripped.
**Intent:** Execute Around idiom frees the user from certain actions that should always be executed before and after the business method. A good example of this is resource allocation and deallocation leaving the user to specify only what to do with the resource.
427
430
@@ -430,7 +433,6 @@ Behavioral patterns are concerned with algorithms and the assignment of responsi
430
433
**Applicability:** Use the Execute Around idiom when
431
434
* You use an API that requires methods to be called in pairs such as open/close or allocate/deallocate.
432
435
433
-
434
436
# Frequently asked questions
435
437
436
438
**<aid="Q1">Q: What is the difference between State and Strategy patterns?</a>**
0 commit comments