Issue #1489 Harvester directories not created causing harvester to not start

Change-Id: Id5caa14ebc33451f95e5d1e9d685c4094091ff63

Former-commit-id: 34577b50dd [formerly 9b75eaf869] [formerly b6bf73134e [formerly 08b944fa708ba12ac6df63b64501ff20f4738063]]
Former-commit-id: b6bf73134e
Former-commit-id: ccf832dd38
This commit is contained in:
Dave Hladky 2013-01-15 12:36:13 -06:00
parent e202452ace
commit fa9dc500a3

View file

@ -154,8 +154,15 @@ public abstract class Crawler {
File lockFileDir, String crawlType) {
FileChannel channel = null;
FileOutputStream fos = null;
// if lock file directories don't exist, create
if (!lockFileDir.exists()) {
lockFileDir.mkdirs();
}
File lockFile = new File(lockFileDir, crawlType + "-crawl.lock");
try {
// if lock file doesn't exist, create it
if (!lockFile.exists()) {
lockFile.createNewFile();
}
@ -165,6 +172,7 @@ public abstract class Crawler {
// Try acquiring the lock without blocking. This method returns
// null or throws an exception if the file is already locked.
FileLock lock = channel.tryLock();
if (lock == null) {
// Someone else has the lock
statusHandler