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
@Overridepublicvoidexecute() { LOGGER.info("우선순위의 작업을 마친 이후 콜백 메서드를 호출한다.");
50
+
}}
51
+
```
52
+
53
+
마지막으로, 다음은 작업을 실행한 후 마쳤을 때 콜백을 받는 방법의 예시이다.
54
+
55
+
```java
56
+
var task =newSimpleTask(); task.executeWith(() ->LOGGER.info("완료되었음."));
57
+
```
58
+
59
+
## 클래스 다이어그램
60
+
61
+

62
+
63
+
## 적용
64
+
65
+
콜백 패턴을 사용할 수 있을 때는
66
+
67
+
* 동기 또는 비동기적인 임의의 행위가 정의된 어떠한 행위의 실행 이후에 수행되어야 할 때이다.
68
+
69
+
## 실질적인 예시들
70
+
71
+
*[CyclicBarrier](http://docs.oracle.com/javase/7/docs/api/java/util/concurrent/CyclicBarrier.html#CyclicBarrier%28int,%20java.lang.Runnable%29) 생성자는 장벽이 넘어질 때마다 발동되는 콜백을 인자로 받을 수 있다.
0 commit comments