@Deprecated public final class ManagedExecutorInitializedBuildItem extends SimpleBuildItem
This build item can be injected in an extension BuildStep to make sure
the Quarkus ManagedExecutor instance is available for injection
during bytecode recording. The executor can only be used from generated bytecode executed at
ExecutionTime.RUNTIME_INIT.
This build item will only be produced if the quarkus-smallrye-context-propagation extension is part of the project
dependencies. Therefore, it must be injected as an Optional build item.
Example code:
public class MyProcessor {
@BuildStep
@Record(ExecutionTime.RUNTIME_INIT)
void buildStep( Optional<ManagedExecutorInitializedBuildItem> managedExecutorInitialized,
BeanContainerBuildItem beanContainer, MyRecorder myRecorder) {
myRecorder.record(managedExecutorInitialized.isPresent(), beanContainer.value());
}
}
@Recorder
public class MyRecorder {
public void record(boolean managedExecutorInitialized, BeanContainer beanContainer) {
if (managedExecutorInitialized) {
ManagedExecutor managedExecutor = beanContainer.instance(ManagedExecutor.class);
// Use it...
}
}
}
Copyright © 2020 JBoss by Red Hat. All rights reserved.