File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
src/main/java/io/engagingspaces/vertx/dataloader Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -138,16 +138,18 @@ public CompositeFuture dispatch() {
138
138
return CompositeFuture .all (Collections .emptyList ());
139
139
}
140
140
CompositeFuture batch = batchLoadFunction .load (loaderQueue .keySet ());
141
- AtomicInteger index = new AtomicInteger (0 );
142
- loaderQueue .forEach ((key , future ) -> {
143
- if (batch .succeeded (index .get ())) {
144
- future .complete (batch .resultAt (index .get ()));
145
- } else {
146
- future .fail (batch .cause (index .get ()));
147
- }
148
- index .incrementAndGet ();
141
+ batch .setHandler (rh -> {
142
+ AtomicInteger index = new AtomicInteger (0 );
143
+ loaderQueue .forEach ((key , future ) -> {
144
+ if (batch .succeeded (index .get ())) {
145
+ future .complete (batch .resultAt (index .get ()));
146
+ } else {
147
+ future .fail (batch .cause (index .get ()));
148
+ }
149
+ index .incrementAndGet ();
150
+ });
151
+ loaderQueue .clear ();
149
152
});
150
- loaderQueue .clear ();
151
153
return batch ;
152
154
}
153
155
You can’t perform that action at this time.
0 commit comments