I am using apache ignite, there is a code block that looks like this:
query.setLocalListener(cacheEntryEvents -> {
Set<String> taskIds = new HashSet<>();
for (CacheEntryEvent<? extends String, ? extends String> e: cacheEntryEvents){
if (e.getEventType().equals(EventType.CREATED)) {
taskIds.add(e.getKey());
}
}
if (!taskIds.isEmpty()){
Set<String> processedTaskId = this.process(taskIds);
taskProcessed.addAndGet(processedTaskId.size());
removeCacheEntryExecutor.removeCache(processedTaskId, inactiveTaskCache);
log.info("Finish processing {} distributed inactive task", processedTaskId.size());
log.info("---------------------------Current total processed task: " + taskProcessed);
}
});
My question is that, does the callback function in this local listener executed as a non-blocking function in a separate thread? Or does it blocks the listener? If the latter case is true, then what happens when this.process(taskIds)
takes too long to execute? If the former case is true, how does it manage the separated thread?