Merge "Issue #1489 Harvester directories not created causing harvester to not start" into 13.2.1_delivery

Former-commit-id: 0e684515c6 [formerly 8388122d8273aca20a9c4292035049957a091a69]
Former-commit-id: 09fb2d0919
This commit is contained in:
Richard Peter 2013-01-15 16:11:35 -06:00 committed by Gerrit Code Review
commit e8a4939150

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