io.github.factoryfx.nanoservice.Nanoservice Maven / Gradle / Ivy
package io.github.factoryfx.nanoservice;
import io.github.factoryfx.factory.FactoryManager;
import io.github.factoryfx.factory.RootFactoryWrapper;
import io.github.factoryfx.factory.exception.RethrowingFactoryExceptionHandler;
public class Nanoservice,RF extends NanoserviceRootFactory> {
private final FactoryManager factoryManager;
private final RF rootFactory;
public Nanoservice(FactoryManager factoryManager, RF rootFactory) {
this.factoryManager = factoryManager;
this.rootFactory = rootFactory;
}
public Nanoservice(RF rootFactory) {
this(new FactoryManager<>(new RethrowingFactoryExceptionHandler()),rootFactory);
}
public R run() {
factoryManager.start(new RootFactoryWrapper<>(rootFactory));
R result = factoryManager.getCurrentFactory().internal().getLiveObject().run();
factoryManager.stop();
return result;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy