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

io.quarkus.oidc.runtime.BlockingTaskRunner Maven / Gradle / Ivy

Go to download

Secure your applications with OpenID Connect Adapter and IDP such as Keycloak

There is a newer version: 3.17.5
Show newest version
package io.quarkus.oidc.runtime;

import java.util.function.Supplier;

import io.quarkus.arc.Arc;
import io.quarkus.oidc.OidcRequestContext;
import io.quarkus.security.spi.runtime.BlockingSecurityExecutor;
import io.smallrye.mutiny.Uni;

public class BlockingTaskRunner implements OidcRequestContext {

    private final BlockingSecurityExecutor blockingExecutor;

    public BlockingTaskRunner() {
        this.blockingExecutor = new BlockingSecurityExecutor() {

            private volatile BlockingSecurityExecutor delegate = null;

            @Override
            public  Uni executeBlocking(Supplier supplier) {
                if (delegate == null) {
                    delegate = Arc.container().select(BlockingSecurityExecutor.class).get();
                }
                return delegate.executeBlocking(supplier);
            }
        };
    }

    public BlockingTaskRunner(BlockingSecurityExecutor blockingExecutor) {
        this.blockingExecutor = blockingExecutor;
    }

    public Uni runBlocking(Supplier function) {
        return blockingExecutor.executeBlocking(function);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy