Search in sources :

Example 1 with ProgressLoggerFactory

use of org.gradle.internal.logging.progress.ProgressLoggerFactory in project gradle by gradle.

the class LazyConsumerActionExecutor method onStartAction.

private ConsumerConnection onStartAction(BuildCancellationToken cancellationToken, InternalBuildProgressListener buildProgressListener) {
    lock.lock();
    try {
        if (stopped) {
            throw new IllegalStateException("This connection has been stopped.");
        }
        executing.add(Thread.currentThread());
        if (connection == null) {
            // Hold the lock while creating the connection. Not generally good form.
            // In this instance, blocks other threads from creating the connection at the same time
            ProgressLoggerFactory progressLoggerFactory = loggingProvider.getProgressLoggerFactory();
            connection = implementationLoader.create(distribution, progressLoggerFactory, buildProgressListener, connectionParameters, cancellationToken);
        }
        return connection;
    } finally {
        lock.unlock();
    }
}
Also used : ProgressLoggerFactory(org.gradle.internal.logging.progress.ProgressLoggerFactory)

Example 2 with ProgressLoggerFactory

use of org.gradle.internal.logging.progress.ProgressLoggerFactory in project gradle by gradle.

the class AbstractJettyRunTask method startJettyInternal.

public void startJettyInternal() {
    ProgressLoggerFactory progressLoggerFactory = getServices().get(ProgressLoggerFactory.class);
    ProgressLogger progressLogger = progressLoggerFactory.newOperation(AbstractJettyRunTask.class).start("Start Jetty server", "Starting Jetty");
    try {
        setServer(createServer());
        applyJettyXml();
        JettyPluginServer plugin = getServer();
        Object[] configuredConnectors = getConnectors();
        plugin.setConnectors(configuredConnectors);
        Object[] connectors = plugin.getConnectors();
        if (connectors == null || connectors.length == 0) {
            configuredConnectors = new Object[] { plugin.createDefaultConnector(getHttpPort()) };
            plugin.setConnectors(configuredConnectors);
        }
        //set up a RequestLog if one is provided
        if (getRequestLog() != null) {
            getServer().setRequestLog(getRequestLog());
        }
        //set up the webapp and any context provided
        getServer().configureHandlers();
        configureWebApplication();
        getServer().addWebApplication(webAppConfig);
        // set up security realms
        Object[] configuredRealms = getUserRealms();
        for (int i = 0; (configuredRealms != null) && i < configuredRealms.length; i++) {
            LOGGER.debug(configuredRealms[i].getClass().getName() + ": " + configuredRealms[i].toString());
        }
        plugin.setUserRealms(configuredRealms);
        //do any other configuration required by the
        //particular Jetty version
        finishConfigurationBeforeStart();
        // start Jetty
        server.start();
        if (getStopPort() != null && getStopPort() > 0 && getStopKey() != null) {
            Monitor monitor = new Monitor(getStopPort(), getStopKey(), (Server) server.getProxiedObject());
            monitor.start();
        }
        if (daemon) {
            return;
        }
        // start the scanner thread (if necessary) on the main webapp
        configureScanner();
        startScanner();
        // start the new line scanner thread if necessary
        startConsoleScanner();
    } catch (Exception e) {
        throw new GradleException("Could not start the Jetty server.", e);
    } finally {
        progressLogger.completed();
    }
    progressLogger = progressLoggerFactory.newOperation(AbstractJettyRunTask.class).start("Run Jetty at http://localhost:" + getHttpPort() + "/" + getContextPath(), "Running at http://localhost:" + getHttpPort() + "/" + getContextPath());
    try {
        // keep the thread going if not in daemon mode
        server.join();
    } catch (Exception e) {
        throw new GradleException("Failed to wait for the Jetty server to stop.", e);
    } finally {
        progressLogger.completed();
    }
}
Also used : Monitor(org.gradle.api.plugins.jetty.internal.Monitor) ProgressLoggerFactory(org.gradle.internal.logging.progress.ProgressLoggerFactory) GradleException(org.gradle.api.GradleException) ProgressLogger(org.gradle.internal.logging.progress.ProgressLogger) JettyPluginServer(org.gradle.api.plugins.jetty.internal.JettyPluginServer) GradleException(org.gradle.api.GradleException)

Example 3 with ProgressLoggerFactory

use of org.gradle.internal.logging.progress.ProgressLoggerFactory in project gradle by gradle.

the class PlayRun method run.

@TaskAction
public void run() {
    ProgressLoggerFactory progressLoggerFactory = getServices().get(ProgressLoggerFactory.class);
    PlayApplicationDeploymentHandle deploymentHandle = registerOrFindDeploymentHandle(getPath());
    if (!deploymentHandle.isRunning()) {
        ProgressLogger progressLogger = progressLoggerFactory.newOperation(PlayRun.class).start("Start Play server", "Starting Play");
        try {
            int httpPort = getHttpPort();
            PlayRunSpec spec = new DefaultPlayRunSpec(runtimeClasspath, changingClasspath, applicationJar, assetsJar, assetsDirs, getProject().getProjectDir(), getForkOptions(), httpPort);
            PlayApplicationRunnerToken runnerToken = playToolProvider.get(PlayApplicationRunner.class).start(spec);
            deploymentHandle.start(runnerToken);
        } finally {
            progressLogger.completed();
        }
    }
    if (!getProject().getGradle().getStartParameter().isContinuous()) {
        ProgressLogger progressLogger = progressLoggerFactory.newOperation(PlayRun.class).start("Run Play App at http://localhost:" + httpPort + "/", "Running at http://localhost:" + httpPort + "/");
        try {
            waitForCtrlD();
        } finally {
            progressLogger.completed();
        }
    } else {
        LOGGER.warn("Running Play App ({}) at http://localhost:{}/", getPath(), httpPort);
    }
}
Also used : DefaultPlayRunSpec(org.gradle.play.internal.run.DefaultPlayRunSpec) PlayApplicationRunner(org.gradle.play.internal.run.PlayApplicationRunner) ProgressLoggerFactory(org.gradle.internal.logging.progress.ProgressLoggerFactory) PlayRunSpec(org.gradle.play.internal.run.PlayRunSpec) DefaultPlayRunSpec(org.gradle.play.internal.run.DefaultPlayRunSpec) ProgressLogger(org.gradle.internal.logging.progress.ProgressLogger) PlayApplicationDeploymentHandle(org.gradle.play.internal.run.PlayApplicationDeploymentHandle) PlayApplicationRunnerToken(org.gradle.play.internal.run.PlayApplicationRunnerToken) TaskAction(org.gradle.api.tasks.TaskAction)

Aggregations

ProgressLoggerFactory (org.gradle.internal.logging.progress.ProgressLoggerFactory)3 ProgressLogger (org.gradle.internal.logging.progress.ProgressLogger)2 GradleException (org.gradle.api.GradleException)1 JettyPluginServer (org.gradle.api.plugins.jetty.internal.JettyPluginServer)1 Monitor (org.gradle.api.plugins.jetty.internal.Monitor)1 TaskAction (org.gradle.api.tasks.TaskAction)1 DefaultPlayRunSpec (org.gradle.play.internal.run.DefaultPlayRunSpec)1 PlayApplicationDeploymentHandle (org.gradle.play.internal.run.PlayApplicationDeploymentHandle)1 PlayApplicationRunner (org.gradle.play.internal.run.PlayApplicationRunner)1 PlayApplicationRunnerToken (org.gradle.play.internal.run.PlayApplicationRunnerToken)1 PlayRunSpec (org.gradle.play.internal.run.PlayRunSpec)1