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

com.atlassian.bamboo.specs.util.IsolatedYamlizator Maven / Gradle / Ivy

There is a newer version: 10.1.0
Show newest version
package com.atlassian.bamboo.specs.util;


import com.atlassian.bamboo.specs.api.model.EntityProperties;

import java.util.function.Function;

public final class IsolatedYamlizator {
    private static final Function DUMP_PROPERTIES = entityProperties -> Yamlizator.getYaml().dump(entityProperties);

    private static final IsolatedExecutor YAMLIZATOR = new IsolatedExecutor<>(DUMP_PROPERTIES, "Yamlizator thread");

    static {
        YAMLIZATOR.start();
    }

    private IsolatedYamlizator() {
    }

    public static String execute(final BambooSpecProperties bambooSpecProperties) {
        try {
            return YAMLIZATOR.execute(bambooSpecProperties);
        } catch (final Throwable e) {
            throw new RuntimeException(e);
        }
    }

    public static Thread getThread() {
        Yamlizator.getYaml(); //run all static initialisation upfront
        return YAMLIZATOR.getThread();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy