io.vertx.up.uca.web.origin.ReceiptInquirer Maven / Gradle / Ivy
package io.vertx.up.uca.web.origin;
import io.vertx.up.atom.worker.Receipt;
import io.vertx.up.log.Annal;
import io.vertx.up.uca.web.thread.QueueThread;
import io.vertx.up.fn.Fn;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
/**
* Receipt annotation inquirer
* This thread is for Receipt extraction
*/
public class ReceiptInquirer implements Inquirer> {
private static final Annal LOGGER = Annal.get(ReceiptInquirer.class);
@Override
public Set scan(final Set> queues) {
final List threadReference = new ArrayList<>();
/* 3.1. Build Metadata **/
for (final Class> queue : queues) {
final QueueThread thread =
new QueueThread(queue);
threadReference.add(thread);
thread.start();
}
/* 3.2. Join **/
Fn.safeJvm(() -> {
for (final QueueThread item : threadReference) {
item.join();
}
}, LOGGER);
/* 3.3. Return **/
final Set receipts = new HashSet<>();
Fn.safeJvm(() -> threadReference.stream()
.map(QueueThread::getReceipts)
.forEach(receipts::addAll), LOGGER);
return receipts;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy