Created
November 9, 2014 05:29
-
-
Save sheimi/02efd04e63ff1f427bb1 to your computer and use it in GitHub Desktop.
code in blog.sheimi.me: 2012-05-17-source-code-02 (3) injector
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void install(JobConf job, Path crawlDb) throws IOException { | |
Path newCrawlDb = FileOutputFormat.getOutputPath(job); | |
FileSystem fs = new JobClient(job).getFs(); | |
Path old = new Path(crawlDb, "old"); | |
Path current = new Path(crawlDb, CURRENT_NAME); | |
if (fs.exists(current)) { | |
if (fs.exists(old)) fs.delete(old, true); | |
fs.rename(current, old); | |
} | |
fs.mkdirs(crawlDb); | |
fs.rename(newCrawlDb, current); | |
if (fs.exists(old)) fs.delete(old, true); | |
Path lock = new Path(crawlDb, LOCK_NAME); | |
LockUtil.removeLockFile(fs, lock); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment