|
15 | 15 | public class TriggerReconcilerOnAllEventReconciler |
16 | 16 | implements Reconciler<TriggerReconcilerOnAllEventCustomResource> { |
17 | 17 |
|
| 18 | + public static final String FINALIZER = "all.event.mode/finalizer"; |
| 19 | + public static final String ADDITIONAL_FINALIZER = "all.event.mode/finalizer2"; |
| 20 | + public static final String NO_MORE_EXCEPTION_ANNOTATION_KEY = "no.more.exception"; |
| 21 | + |
18 | 22 | private static final Logger log = |
19 | 23 | LoggerFactory.getLogger(TriggerReconcilerOnAllEventReconciler.class); |
20 | 24 |
|
| 25 | + // control flags to throw exceptions in certain situations |
21 | 26 | private volatile boolean throwExceptionOnFirstDeleteEvent = false; |
22 | 27 | private volatile boolean throwExceptionIfNoAnnotation = false; |
23 | 28 |
|
| 29 | + // flags for managing wait within reconciliation, |
| 30 | + // so we can send an update while reconciliation is in progress |
24 | 31 | private volatile boolean waitAfterFirstRetry = false; |
25 | 32 | private volatile boolean continuerOnRetryWait = false; |
26 | 33 | private volatile boolean waiting = false; |
27 | 34 |
|
| 35 | + // control flag to throw an exception on first delete event |
28 | 36 | private volatile boolean isFirstDeleteEvent = true; |
| 37 | + // control if the reconciler should add / remove the finalizer |
| 38 | + private volatile boolean useFinalizer = true; |
29 | 39 |
|
30 | | - public static final String FINALIZER = "all.event.mode/finalizer"; |
31 | | - public static final String ADDITIONAL_FINALIZER = "all.event.mode/finalizer2"; |
32 | | - public static final String NO_MORE_EXCEPTION_ANNOTATION_KEY = "no.more.exception"; |
33 | | - |
34 | | - protected volatile boolean useFinalizer = true; |
35 | | - |
36 | | - private final AtomicInteger eventCounter = new AtomicInteger(0); |
37 | | - |
| 40 | + // flags to flip if reconciled primary resource in certain state |
38 | 41 | private boolean deleteEventPresent = false; |
39 | 42 | private boolean eventOnMarkedForDeletion = false; |
40 | 43 | private boolean resourceEventPresent = false; |
| 44 | + // counter for how many times the reconciler has been called |
| 45 | + private final AtomicInteger reconciliationCounter = new AtomicInteger(0); |
41 | 46 |
|
42 | 47 | @Override |
43 | 48 | public UpdateControl<TriggerReconcilerOnAllEventCustomResource> reconcile( |
@@ -143,11 +148,11 @@ public void setWaiting(boolean waiting) { |
143 | 148 | } |
144 | 149 |
|
145 | 150 | public int getEventCount() { |
146 | | - return eventCounter.get(); |
| 151 | + return reconciliationCounter.get(); |
147 | 152 | } |
148 | 153 |
|
149 | 154 | public void increaseEventCount() { |
150 | | - eventCounter.incrementAndGet(); |
| 155 | + reconciliationCounter.incrementAndGet(); |
151 | 156 | } |
152 | 157 |
|
153 | 158 | public boolean getUseFinalizer() { |
|
0 commit comments