mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-09-26 23:55:50 +00:00
Reduce synchronization bottlenecks
* FrontierJournal, CrawlerJournal
do barest minimum inside 'synchronized' method
This commit is contained in:
@@ -92,15 +92,10 @@ public class CrawlerJournal implements Closeable {
|
||||
this.out = initialize(gzipFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate a buffer for accumulating lines to write and reuse it.
|
||||
*/
|
||||
protected MutableString accumulatingBuffer = new MutableString(1024);
|
||||
|
||||
protected Writer initialize(final File f) throws FileNotFoundException, IOException {
|
||||
FileUtils.moveAsideIfExists(f);
|
||||
return new OutputStreamWriter(new GZIPOutputStream(
|
||||
new FastBufferedOutputStream(new FileOutputStream(f))));
|
||||
new FastBufferedOutputStream(new FileOutputStream(f),32*1024)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -84,15 +84,8 @@ public class FrontierJournal extends CrawlerJournal {
|
||||
writeLongUriLine(F_ADD, curi);
|
||||
}
|
||||
|
||||
public synchronized void writeLongUriLine(String tag, CrawlURI curi) {
|
||||
accumulatingBuffer.length(0);
|
||||
this.accumulatingBuffer.append(tag).
|
||||
append(curi.toString()).
|
||||
append(" ").
|
||||
append(curi.getPathFromSeed()).
|
||||
append(" ").
|
||||
append(curi.flattenVia());
|
||||
writeLine(accumulatingBuffer);
|
||||
public void writeLongUriLine(String tag, CrawlURI curi) {
|
||||
writeLine(tag, curi.toString(), " ",curi.getPathFromSeed(), " ", curi.flattenVia());
|
||||
}
|
||||
|
||||
public void finishedSuccess(CrawlURI curi) {
|
||||
|
||||
Reference in New Issue
Block a user