use of org.eclipse.jetty.util.Scanner in project jetty.project by eclipse.
the class ScanningAppProvider method doStart.
/* ------------------------------------------------------------ */
@Override
protected void doStart() throws Exception {
if (LOG.isDebugEnabled())
LOG.debug(this.getClass().getSimpleName() + ".doStart()");
if (_monitored.size() == 0)
throw new IllegalStateException("No configuration dir specified");
LOG.info("Deployment monitor " + _monitored + " at interval " + _scanInterval);
List<File> files = new ArrayList<>();
for (Resource resource : _monitored) {
if (resource.exists() && resource.getFile().canRead())
files.add(resource.getFile());
else
LOG.warn("Does not exist: " + resource);
}
_scanner = new Scanner();
_scanner.setScanDirs(files);
_scanner.setScanInterval(_scanInterval);
_scanner.setRecursive(_recursive);
_scanner.setFilenameFilter(_filenameFilter);
_scanner.setReportDirs(true);
_scanner.addListener(_scannerListener);
_scanner.start();
}
use of org.eclipse.jetty.util.Scanner in project blade by biezhi.
the class EmbedJettyServer method hotSwap.
public void hotSwap(int scanInterval, String resBase) throws Exception {
Scanner scanner = new Scanner();
scanner.setScanInterval(scanInterval);
scanner.addScanDir(new File(resBase));
scanner.addListener((Scanner.BulkListener) fileNames -> {
webAppContext.stop();
webAppContext.setResourceBase(resBase);
webAppContext.start();
webAppContext.getHandler().start();
});
LOGGER.info("Hot Swap scan interval is {}s.", scanInterval);
scanner.start();
}
use of org.eclipse.jetty.util.Scanner in project jetty.project by eclipse.
the class ServerProxyImpl method startScanners.
/**
* Starts web applications' scanners.
*/
private void startScanners() throws Exception {
for (AntWebAppContext awc : webApplications) {
if (scanIntervalSecs <= 0)
return;
List<File> scanList = awc.getScanFiles();
TaskLog.log("Web application '" + awc + "': starting scanner at interval of " + scanIntervalSecs + " seconds.");
Scanner.Listener changeListener = new WebAppScannerListener(awc);
Scanner scanner = new Scanner();
scanner.setScanInterval(scanIntervalSecs);
scanner.addListener(changeListener);
scanner.setScanDirs(scanList);
scanner.setReportExistingFilesOnStartup(false);
scanner.start();
}
}
Aggregations