Search in sources :

Example 1 with BackgroundTaskProcessor

use of org.finos.legend.sdlc.server.tools.BackgroundTaskProcessor in project legend-sdlc by finos.

the class AbstractGitLabApiTest method suiteSetup.

@BeforeClass
public static void suiteSetup() {
    JerseyGuiceUtils.install((s, serviceLocator) -> null);
    backgroundTaskProcessor = new BackgroundTaskProcessor(1);
    prepareGitLabUser();
}
Also used : BackgroundTaskProcessor(org.finos.legend.sdlc.server.tools.BackgroundTaskProcessor) BeforeClass(org.junit.BeforeClass)

Example 2 with BackgroundTaskProcessor

use of org.finos.legend.sdlc.server.tools.BackgroundTaskProcessor in project legend-sdlc by finos.

the class BaseLegendSDLCServer method run.

@Override
public void run(T configuration, Environment environment) {
    super.run(configuration, environment);
    LifecycleEnvironment lifecycleEnvironment = environment.lifecycle();
    LOGGER.debug("Creating background task processor");
    BackgroundTaskProcessor taskProcessor = new BackgroundTaskProcessor(1);
    lifecycleEnvironment.manage(new Managed() {

        @Override
        public void start() {
        // nothing to do
        }

        @Override
        public void stop() throws Exception {
            LOGGER.debug("Shutting down background task processor");
            taskProcessor.shutdown();
            if (taskProcessor.awaitTermination(30, TimeUnit.SECONDS)) {
                LOGGER.debug("Done shutting down background task processor");
            } else {
                LOGGER.debug("Background task processor did not terminate within the timeout");
            }
        }
    });
    this.backgroundTaskProcessor = taskProcessor;
}
Also used : BackgroundTaskProcessor(org.finos.legend.sdlc.server.tools.BackgroundTaskProcessor) LifecycleEnvironment(io.dropwizard.lifecycle.setup.LifecycleEnvironment) Managed(io.dropwizard.lifecycle.Managed)

Example 3 with BackgroundTaskProcessor

use of org.finos.legend.sdlc.server.tools.BackgroundTaskProcessor in project legend-sdlc by finos.

the class AbstractGitLabServerApiTest method suiteSetup.

@BeforeClass
public static void suiteSetup() {
    JerseyGuiceUtils.install((s, serviceLocator) -> null);
    backgroundTaskProcessor = new BackgroundTaskProcessor(1);
}
Also used : BackgroundTaskProcessor(org.finos.legend.sdlc.server.tools.BackgroundTaskProcessor) BeforeClass(org.junit.BeforeClass)

Aggregations

BackgroundTaskProcessor (org.finos.legend.sdlc.server.tools.BackgroundTaskProcessor)3 BeforeClass (org.junit.BeforeClass)2 Managed (io.dropwizard.lifecycle.Managed)1 LifecycleEnvironment (io.dropwizard.lifecycle.setup.LifecycleEnvironment)1