use of io.vertx.up.web.thread.QueueThread in project vertx-zero by silentbalanceyh.
the class ReceiptInquirer method scan.
@Override
public Set<Receipt> scan(final Set<Class<?>> queues) {
final List<QueueThread> 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<Receipt> receipts = new HashSet<>();
Fn.safeJvm(() -> {
for (final QueueThread item : threadReference) {
receipts.addAll(item.getReceipts());
}
}, LOGGER);
return receipts;
}
Aggregations