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

io.smallrye.faulttolerance.config.AsynchronousNonBlockingConfig Maven / Gradle / Ivy

There is a newer version: 6.6.2
Show newest version
package io.smallrye.faulttolerance.config;

import java.util.StringJoiner;

import org.eclipse.microprofile.faulttolerance.exceptions.FaultToleranceDefinitionException;

import io.smallrye.faulttolerance.api.AsynchronousNonBlocking;
import io.smallrye.faulttolerance.autoconfig.AutoConfig;
import io.smallrye.faulttolerance.autoconfig.Config;
import io.smallrye.faulttolerance.core.invocation.AsyncSupport;
import io.smallrye.faulttolerance.core.invocation.AsyncSupportRegistry;

@AutoConfig
public interface AsynchronousNonBlockingConfig extends AsynchronousNonBlocking, Config {
    @Override
    default void validate() {
        Class[] parameterTypes = method().parameterTypes;
        Class returnType = method().returnType;
        if (AsyncSupportRegistry.isKnown(parameterTypes, returnType)) {
            return;
        }

        StringJoiner knownAsync = new StringJoiner(" or ");
        for (AsyncSupport asyncSupport : AsyncSupportRegistry.allKnown()) {
            knownAsync.add(asyncSupport.mustDescription());
        }
        throw new FaultToleranceDefinitionException("Invalid @AsynchronousNonBlocking on " + method()
                + ": must " + knownAsync);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy