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();
}
}
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();
}
}
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);
}
}
Aggregations