3086: Commit after each item to increase performance

This commit is contained in:
Tom Desair
2016-04-21 11:45:41 +02:00
committed by dylan
parent a98fee0b5e
commit cf77978603

View File

@@ -77,9 +77,6 @@ public class OAIHarvester {
protected PluginService pluginService;
protected ConfigurationService configurationService;
// try to empty the cache on regular intervals
public static final int CACHE_SIZE_LIMIT = 2000;
// The collection this harvester instance is dealing with
Collection targetCollection;
@@ -368,11 +365,7 @@ public class OAIHarvester {
processRecord(record, OREPrefix, currentRecord, totalListSize);
ourContext.dispatchEvents();
// here we might need to clear the cache and update the total we have done so far
if(ourContext.getCacheSize() >= CACHE_SIZE_LIMIT)
{
clearCache();
}
intermediateCommit();
}
}
@@ -445,23 +438,6 @@ public class OAIHarvester {
reloadRequiredEntities();
}
/**
* Reset the OAI cache, will commit our currently ingested items and create a new context.
*/
protected void clearCache()
{
try
{
ourContext.clearCache();
reloadRequiredEntities();
}
catch(Exception ex)
{
log.error(LogManager.getHeader(ourContext, "oai_harvest_cache_reset_error", "Error while attempting to reset the cache for the OAI harvest"), ex);
}
}
private void reloadRequiredEntities() throws SQLException {
//Reload our objects in our cache
targetCollection = ourContext.reloadEntity(targetCollection);