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

Change-Id: Id5caa14ebc33451f95e5d1e9d685c4094091ff63

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

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