mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-08 10:34:25 +00:00
3086: Commit after each item to increase performance
This commit is contained in:
@@ -77,9 +77,6 @@ public class OAIHarvester {
|
|||||||
protected PluginService pluginService;
|
protected PluginService pluginService;
|
||||||
protected ConfigurationService configurationService;
|
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
|
// The collection this harvester instance is dealing with
|
||||||
Collection targetCollection;
|
Collection targetCollection;
|
||||||
@@ -368,11 +365,7 @@ public class OAIHarvester {
|
|||||||
processRecord(record, OREPrefix, currentRecord, totalListSize);
|
processRecord(record, OREPrefix, currentRecord, totalListSize);
|
||||||
ourContext.dispatchEvents();
|
ourContext.dispatchEvents();
|
||||||
|
|
||||||
// here we might need to clear the cache and update the total we have done so far
|
intermediateCommit();
|
||||||
if(ourContext.getCacheSize() >= CACHE_SIZE_LIMIT)
|
|
||||||
{
|
|
||||||
clearCache();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -445,23 +438,6 @@ public class OAIHarvester {
|
|||||||
reloadRequiredEntities();
|
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 {
|
private void reloadRequiredEntities() throws SQLException {
|
||||||
//Reload our objects in our cache
|
//Reload our objects in our cache
|
||||||
targetCollection = ourContext.reloadEntity(targetCollection);
|
targetCollection = ourContext.reloadEntity(targetCollection);
|
||||||
|
Reference in New Issue
Block a user