io.quarkus.arc.runtime.BeanInvoker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of quarkus-arc Show documentation
Show all versions of quarkus-arc Show documentation
Build time CDI dependency injection
package io.quarkus.arc.runtime;
import io.quarkus.arc.Arc;
import io.quarkus.arc.ManagedContext;
/**
* Invokes a business method of a bean. The request context is activated if necessary.
*
* @param
*/
public interface BeanInvoker {
default void invoke(T param) throws Exception {
ManagedContext requestContext = Arc.container().requestContext();
if (requestContext.isActive()) {
invokeBean(param);
} else {
try {
requestContext.activate();
invokeBean(param);
} finally {
requestContext.terminate();
}
}
}
void invokeBean(T param) throws Exception;
}