File tree Expand file tree Collapse file tree 4 files changed +24
-3
lines changed
db-scheduler/src/test/java/com/github/kagkarlsson/scheduler/helper Expand file tree Collapse file tree 4 files changed +24
-3
lines changed Original file line number Diff line number Diff line change 1
1
package com .github .kagkarlsson .scheduler .helper ;
2
2
3
3
import com .github .kagkarlsson .scheduler .stats .StatsRegistry ;
4
+ import com .github .kagkarlsson .scheduler .task .ExecutionComplete ;
5
+ import com .github .kagkarlsson .scheduler .task .ExecutionComplete .Result ;
4
6
import java .util .concurrent .CountDownLatch ;
5
7
import org .slf4j .LoggerFactory ;
6
8
@@ -32,10 +34,13 @@ public void apply(StatsRegistry.SchedulerStatsEvent e) {}
32
34
public void apply (StatsRegistry .CandidateStatsEvent e ) {}
33
35
34
36
@ Override
35
- public void apply (StatsRegistry .ExecutionStatsEvent e ) {
36
- if (e == StatsRegistry .ExecutionStatsEvent .COMPLETED ) {
37
+ public void apply (StatsRegistry .ExecutionStatsEvent e ) {}
38
+
39
+ @ Override
40
+ public void applyExecutionComplete (ExecutionComplete complete ) {
41
+ if (complete .getResult () == Result .OK ) {
37
42
LoggerFactory .getLogger (ExecutionCompletedCondition .class )
38
- .debug ("Received event execution-completed, counting down" );
43
+ .debug ("Received event execution-completed, counting down" );
39
44
completed .countDown ();
40
45
}
41
46
}
Original file line number Diff line number Diff line change 1
1
package com .github .kagkarlsson .scheduler .helper ;
2
2
3
3
import com .github .kagkarlsson .scheduler .stats .StatsRegistry ;
4
+ import com .github .kagkarlsson .scheduler .task .ExecutionComplete ;
4
5
import java .util .concurrent .CountDownLatch ;
5
6
import org .slf4j .LoggerFactory ;
6
7
@@ -39,4 +40,7 @@ public void apply(StatsRegistry.CandidateStatsEvent e) {}
39
40
40
41
@ Override
41
42
public void apply (StatsRegistry .ExecutionStatsEvent e ) {}
43
+
44
+ @ Override
45
+ public void applyExecutionComplete (ExecutionComplete complete ) {}
42
46
}
Original file line number Diff line number Diff line change 2
2
3
3
import com .github .kagkarlsson .scheduler .stats .StatsRegistry ;
4
4
import com .github .kagkarlsson .scheduler .stats .StatsRegistry .SchedulerStatsEvent ;
5
+ import com .github .kagkarlsson .scheduler .task .ExecutionComplete ;
5
6
import java .util .concurrent .CountDownLatch ;
6
7
import org .slf4j .Logger ;
7
8
import org .slf4j .LoggerFactory ;
@@ -41,4 +42,7 @@ public void apply(StatsRegistry.CandidateStatsEvent e) {}
41
42
42
43
@ Override
43
44
public void apply (StatsRegistry .ExecutionStatsEvent e ) {}
45
+
46
+ @ Override
47
+ public void applyExecutionComplete (ExecutionComplete complete ) {}
44
48
}
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ public void register(ExecutionStatsEvent e) {
61
61
62
62
@ Override
63
63
public void registerSingleCompletedExecution (ExecutionComplete completeEvent ) {
64
+ applyToConditions (completeEvent );
64
65
completed .add (completeEvent );
65
66
log (completeEvent );
66
67
}
@@ -95,6 +96,11 @@ private void applyToConditions(ExecutionStatsEvent e) {
95
96
waitConditions .forEach (c -> c .apply (e ));
96
97
}
97
98
99
+ private void applyToConditions (ExecutionComplete complete ) {
100
+ waitConditions .forEach (c -> c .applyExecutionComplete (complete ));
101
+ }
102
+
103
+
98
104
private void countEvent (Enum e ) {
99
105
String key = counterKey (e .getClass (), e .name ());
100
106
AtomicLong counter = counters .get (key );
@@ -146,6 +152,8 @@ public interface Condition {
146
152
void apply (CandidateStatsEvent e );
147
153
148
154
void apply (ExecutionStatsEvent e );
155
+
156
+ void applyExecutionComplete (ExecutionComplete complete );
149
157
}
150
158
151
159
public static class Builder {
You can’t perform that action at this time.
0 commit comments