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

io.quarkus.undertow.runtime.QuarkusInstanceFactory Maven / Gradle / Ivy

There is a newer version: 3.17.0
Show newest version
package io.quarkus.undertow.runtime;

import io.quarkus.arc.runtime.BeanContainer;
import io.undertow.servlet.api.InstanceFactory;
import io.undertow.servlet.api.InstanceHandle;

public class QuarkusInstanceFactory implements InstanceFactory {

    private final BeanContainer.Factory factory;

    public QuarkusInstanceFactory(BeanContainer.Factory factory) {
        this.factory = factory;
    }

    @Override
    public InstanceHandle createInstance() throws InstantiationException {
        BeanContainer.Instance instance = factory.create();
        return new InstanceHandle() {
            @Override
            public T getInstance() {
                return instance.get();
            }

            @Override
            public void release() {
                instance.close();
            }
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy