public void run() { // TODO: replace by NIO WatcherService (requires upgrade to Java 7) while (directory != null) { try { Thread.sleep(scanIntervalInMillis); doDeploy(); } catch (InterruptedException e) { log.error("Data set watcher thread error.", e); } } } });
public synchronized void deploy(final String dir) { if (scanIntervalInMillis < 1000) { log.error("Polling time can't be lower than 1000 ms"); return; } if (!validateDirectory(dir)) { log.warn("Data sets deployment directory invalid: " + dir); directory = null; return; } log.info("Data sets deployment directory = " + dir); directory = dir; doDeploy(); if (scanIntervalInMillis > 0 && watcherThread == null) { watcherThread = new Thread(new Runnable() { public void run() { // TODO: replace by NIO WatcherService (requires upgrade to Java 7) while (directory != null) { try { Thread.sleep(scanIntervalInMillis); doDeploy(); } catch (InterruptedException e) { log.error("Data set watcher thread error.", e); } } } }); watcherThread.start(); } }