Search in sources :

Example 1 with EndPointThread

use of io.vertx.up.web.thread.EndPointThread in project vertx-zero by silentbalanceyh.

the class EventInquirer method scan.

@Override
public Set<Event> scan(final Set<Class<?>> endpoints) {
    final List<EndPointThread> threadReference = new ArrayList<>();
    /**
     * 2.1.Build Api metadata *
     */
    for (final Class<?> endpoint : endpoints) {
        final EndPointThread thread = new EndPointThread(endpoint);
        threadReference.add(thread);
        thread.start();
    }
    /**
     * 3.2. Join *
     */
    Fn.safeJvm(() -> {
        for (final EndPointThread item : threadReference) {
            item.join();
        }
    }, LOGGER);
    /**
     * 3.3. Finally *
     */
    final Set<Event> events = new HashSet<>();
    Fn.safeJvm(() -> {
        for (final EndPointThread item : threadReference) {
            events.addAll(item.getEvents());
        }
    }, LOGGER);
    return events;
}
Also used : ArrayList(java.util.ArrayList) Event(io.vertx.up.atom.agent.Event) EndPointThread(io.vertx.up.web.thread.EndPointThread) HashSet(java.util.HashSet)

Aggregations

Event (io.vertx.up.atom.agent.Event)1 EndPointThread (io.vertx.up.web.thread.EndPointThread)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1