All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.quarkus.arc.runtime.BeanInvoker Maven / Gradle / Ivy

There is a newer version: 3.17.0.CR1
Show newest version
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;

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy