Archived
0

Some more commenting for AsyncEventLoop

This commit is contained in:
Daniil
2018-07-26 11:23:11 +07:00
parent abae528d0b
commit 8c6c6bde6c

View File

@@ -27,11 +27,14 @@ public class AsyncEventLoop extends AdvancedEventLoop {
// Submit all defined preprocessing methods as async tasks // Submit all defined preprocessing methods as async tasks
for (int i = 0; i < handlerList.size(); i++) { for (int i = 0; i < handlerList.size(); i++) {
if (handlerList.get(i).getPreprocessMethod() == null) { if (handlerList.get(i).getPreprocessMethod() == null) {
// We have already "allocated" a space for this task in CountDownLatch,
// but since there is no actual preprocess method defined for this handler
// we just skip it by ticking the latch down manually
latch.countDown(); latch.countDown();
continue; } else {
}
preEventExecutor.submit(new PreprocessTask(i, eventBatch, latch, handlerList.get(i), event)); preEventExecutor.submit(new PreprocessTask(i, eventBatch, latch, handlerList.get(i), event));
} }
}
// Await for them to complete // Await for them to complete
try { try {
@@ -44,9 +47,7 @@ public class AsyncEventLoop extends AdvancedEventLoop {
// data obtained from EventBatch // data obtained from EventBatch
for (int i = 0; i < handlerList.size(); i++) { for (int i = 0; i < handlerList.size(); i++) {
ExecutorLink link = handlerList.get(i); ExecutorLink link = handlerList.get(i);
if (link.isIgnoreCancelled() && event.isCanceled()) if (!link.isIgnoreCancelled() || !event.isCanceled()) {
continue;
try { try {
if (link.getResultInjection() != null) if (link.getResultInjection() != null)
link.getMethod().invoke(link.getObject(), event, eventBatch.getInjectionObject(i)); link.getMethod().invoke(link.getObject(), event, eventBatch.getInjectionObject(i));
@@ -59,4 +60,5 @@ public class AsyncEventLoop extends AdvancedEventLoop {
} }
} }
} }
}