Search in sources :

Example 1 with PathWatcher

use of org.eclipse.jetty.util.PathWatcher in project jetty.project by eclipse.

the class PropertyUserStore method doStart.

/* ------------------------------------------------------------ */
/**
     * Depending on the value of the refresh interval, this method will either start up a scanner thread that will monitor the properties file for changes after
     * it has initially loaded it. Otherwise the users will be loaded and there will be no active monitoring thread so changes will not be detected.
     *
     *
     * @see org.eclipse.jetty.util.component.AbstractLifeCycle#doStart()
     */
protected void doStart() throws Exception {
    super.doStart();
    loadUsers();
    if (isHotReload() && (_configPath != null)) {
        this.pathWatcher = new PathWatcher();
        this.pathWatcher.watch(_configPath);
        this.pathWatcher.addListener(this);
        this.pathWatcher.setNotifyExistingOnStart(false);
        this.pathWatcher.start();
    }
}
Also used : PathWatcher(org.eclipse.jetty.util.PathWatcher)

Example 2 with PathWatcher

use of org.eclipse.jetty.util.PathWatcher in project blade by biezhi.

the class PropertyUserStore method doStart.

/* ------------------------------------------------------------ */
/**
     * Depending on the value of the refresh interval, this method will either start up a scanner thread that will monitor the properties file for changes after
     * it has initially loaded it. Otherwise the users will be loaded and there will be no active monitoring thread so changes will not be detected.
     *
     *
     * @see AbstractLifeCycle#doStart()
     */
protected void doStart() throws Exception {
    super.doStart();
    loadUsers();
    if (isHotReload() && (_configPath != null)) {
        this.pathWatcher = new PathWatcher();
        this.pathWatcher.watch(_configPath);
        this.pathWatcher.addListener(this);
        this.pathWatcher.setNotifyExistingOnStart(false);
        this.pathWatcher.start();
    }
}
Also used : PathWatcher(org.eclipse.jetty.util.PathWatcher)

Example 3 with PathWatcher

use of org.eclipse.jetty.util.PathWatcher in project jetty.project by eclipse.

the class AbstractJettyMojo method startJetty.

public void startJetty() throws MojoExecutionException {
    try {
        getLog().debug("Starting Jetty Server ...");
        //make sure Jetty does not use URLConnection caches with the plugin
        Resource.setDefaultUseCaches(false);
        configureMonitor();
        printSystemProperties();
        //apply any config from a jetty.xml file first which is able to
        //be overwritten by config in the pom.xml
        applyJettyXml();
        // if a <httpConnector> was specified in the pom, use it
        if (httpConnector != null) {
            // check that its port was set
            if (httpConnector.getPort() <= 0) {
                //use any jetty.http.port settings provided
                String tmp = System.getProperty(MavenServerConnector.PORT_SYSPROPERTY, System.getProperty("jetty.port", MavenServerConnector.DEFAULT_PORT_STR));
                httpConnector.setPort(Integer.parseInt(tmp.trim()));
            }
            httpConnector.setServer(server);
        }
        ServerSupport.configureConnectors(server, httpConnector);
        //set up a RequestLog if one is provided and the handle structure
        ServerSupport.configureHandlers(server, this.requestLog);
        //Set up list of default Configurations to apply to a webapp
        ServerSupport.configureDefaultConfigurationClasses(server);
        configureWebApplication();
        ServerSupport.addWebApplication(server, webApp);
        // set up security realms
        ServerSupport.configureLoginServices(server, loginServices);
        //do any other configuration required by the
        //particular Jetty version
        finishConfigurationBeforeStart();
        // start Jetty
        this.server.start();
        getLog().info("Started Jetty Server");
        if (dumpOnStart) {
            getLog().info(this.server.dump());
        }
        // start the scanner thread (if necessary) on the main webapp
        if (isScanningEnabled()) {
            scanner = new PathWatcher();
            configureScanner();
            startScanner();
        }
        // start the new line scanner thread if necessary
        startConsoleScanner();
        // keep the thread going if not in daemon mode
        if (!nonblocking) {
            server.join();
        }
    } catch (Exception e) {
        throw new MojoExecutionException("Failure", e);
    } finally {
        if (!nonblocking) {
            getLog().info("Jetty server exiting.");
        }
    }
}
Also used : MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) PathWatcher(org.eclipse.jetty.util.PathWatcher) MalformedURLException(java.net.MalformedURLException) MojoExecutionException(org.apache.maven.plugin.MojoExecutionException) MojoFailureException(org.apache.maven.plugin.MojoFailureException)

Aggregations

PathWatcher (org.eclipse.jetty.util.PathWatcher)3 MalformedURLException (java.net.MalformedURLException)1 MojoExecutionException (org.apache.maven.plugin.MojoExecutionException)1 MojoFailureException (org.apache.maven.plugin.MojoFailureException)1