SOLR-793: fix possible deadlock

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@719347 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2008-11-20 19:52:11 +00:00
parent 177f900343
commit 075cdc5890
1 changed files with 7 additions and 2 deletions

View File

@ -465,6 +465,11 @@ public class DirectUpdateHandler2 extends UpdateHandler {
/** schedule individual commits */
public synchronized void scheduleCommitWithin(long commitMaxTime)
{
_scheduleCommitWithin( commitMaxTime );
}
private void _scheduleCommitWithin(long commitMaxTime)
{
// Check if there is a commit already scheduled for longer then this time
if( pending != null &&
@ -487,13 +492,13 @@ public class DirectUpdateHandler2 extends UpdateHandler {
lastAddedTime = System.currentTimeMillis();
// maxDocs-triggered autoCommit
if( docsUpperBound > 0 && (docsSinceCommit > docsUpperBound) ) {
scheduleCommitWithin( DOC_COMMIT_DELAY_MS );
_scheduleCommitWithin( DOC_COMMIT_DELAY_MS );
}
// maxTime-triggered autoCommit
long ctime = (commitWithin>0) ? commitWithin : timeUpperBound;
if( ctime > 0 ) {
scheduleCommitWithin( ctime );
_scheduleCommitWithin( ctime );
}
}