/** *checkformodificationandsendnotificationtolistener
*/ publicvoid check() { if (log.isDebugEnabled()) {
log.debug(sm.getString("warWatcher.checkingWars", watchDir));
}
File[] list = watchDir.listFiles(new WarFilter()); if (list == null) {
log.warn(sm.getString("warWatcher.cantListWatchDir", watchDir));
list = new File[0];
} // first make sure all the files are listed in our current status for (File file : list) { if (!file.exists()) {
log.warn(sm.getString("warWatcher.listedFileDoesNotExist", file, watchDir));
}
addWarInfo(file);
}
// Check all the status codes and update the FarmDeployer for (Iterator<Map.Entry<String,WarInfo>> i = currentStatus.entrySet().iterator(); i.hasNext();) {
Map.Entry<String,WarInfo> entry = i.next();
WarInfo info = entry.getValue(); if (log.isTraceEnabled()) {
log.trace(sm.getString("warWatcher.checkingWar", info.getWar()));
} int check = info.check(); if (check == 1) {
listener.fileModified(info.getWar());
} elseif (check == -1) {
listener.fileRemoved(info.getWar()); // no need to keep in memory
i.remove();
} if (log.isTraceEnabled()) {
log.trace(sm.getString("warWatcher.checkWarResult", Integer.valueOf(check), info.getWar()));
}
}
}
/** *addclusterwartothewatcherstate * *@paramwarfileTheWARtoadd
*/ protectedvoid addWarInfo(File warfile) {
WarInfo info = currentStatus.get(warfile.getAbsolutePath()); if (info == null) {
info = new WarInfo(warfile);
info.setLastState(-1); // assume file is non existent
currentStatus.put(warfile.getAbsolutePath(), info);
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.