Search in sources :

Example 1 with EventLoopSupplierBuildItem

use of io.quarkus.netty.deployment.EventLoopSupplierBuildItem in project quarkus by quarkusio.

the class VertxCoreProcessor method build.

@BuildStep
@Produce(ServiceStartBuildItem.class)
@Record(value = ExecutionTime.RUNTIME_INIT)
CoreVertxBuildItem build(VertxCoreRecorder recorder, LaunchModeBuildItem launchMode, ShutdownContextBuildItem shutdown, VertxConfiguration config, List<VertxOptionsConsumerBuildItem> vertxOptionsConsumers, BuildProducer<SyntheticBeanBuildItem> syntheticBeans, BuildProducer<EventLoopSupplierBuildItem> eventLoops, ExecutorBuildItem executorBuildItem) {
    Collections.sort(vertxOptionsConsumers);
    List<Consumer<VertxOptions>> consumers = new ArrayList<>(vertxOptionsConsumers.size());
    for (VertxOptionsConsumerBuildItem x : vertxOptionsConsumers) {
        consumers.add(x.getConsumer());
    }
    Supplier<Vertx> vertx = recorder.configureVertx(config, launchMode.getLaunchMode(), shutdown, consumers, executorBuildItem.getExecutorProxy());
    syntheticBeans.produce(SyntheticBeanBuildItem.configure(Vertx.class).types(Vertx.class).scope(Singleton.class).unremovable().setRuntimeInit().supplier(vertx).done());
    // Event loops are only usable after the core vertx instance is configured
    eventLoops.produce(new EventLoopSupplierBuildItem(recorder.mainSupplier(), recorder.bossSupplier()));
    if (launchMode.getLaunchMode().isDevOrTest()) {
        handleBlockingWarningsInDevOrTestMode();
    }
    return new CoreVertxBuildItem(vertx);
}
Also used : EventLoopSupplierBuildItem(io.quarkus.netty.deployment.EventLoopSupplierBuildItem) Consumer(java.util.function.Consumer) Singleton(javax.inject.Singleton) ArrayList(java.util.ArrayList) Vertx(io.vertx.core.Vertx) Produce(io.quarkus.deployment.annotations.Produce) BuildStep(io.quarkus.deployment.annotations.BuildStep) LogRecord(java.util.logging.LogRecord) Record(io.quarkus.deployment.annotations.Record)

Aggregations

BuildStep (io.quarkus.deployment.annotations.BuildStep)1 Produce (io.quarkus.deployment.annotations.Produce)1 Record (io.quarkus.deployment.annotations.Record)1 EventLoopSupplierBuildItem (io.quarkus.netty.deployment.EventLoopSupplierBuildItem)1 Vertx (io.vertx.core.Vertx)1 ArrayList (java.util.ArrayList)1 Consumer (java.util.function.Consumer)1 LogRecord (java.util.logging.LogRecord)1 Singleton (javax.inject.Singleton)1