mirror of https://github.com/apache/lucene.git
SOLR-1711: StreamingUpdateSolrServer race
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@903271 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
fcc5fed4e5
commit
05a802b3eb
|
@ -162,6 +162,9 @@ Bug Fixes
|
|||
* SOLR-1667: PatternTokenizer does not reset attributes such as positionIncrementGap
|
||||
(Robert Muir via shalin)
|
||||
|
||||
* SOLR-1711: SolrJ - StreamingUpdateSolrServer had a race condition that
|
||||
could halt the streaming of documents. (Attila Babo via yonik)
|
||||
|
||||
Other Changes
|
||||
----------------------
|
||||
|
||||
|
|
|
@ -99,6 +99,7 @@ public class StreamingUpdateSolrServer extends CommonsHttpSolrServer
|
|||
log.info( "starting runner: {}" , this );
|
||||
PostMethod method = null;
|
||||
try {
|
||||
do {
|
||||
RequestEntity request = new RequestEntity() {
|
||||
// we don't know the length
|
||||
public long getContentLength() { return -1; }
|
||||
|
@ -159,6 +160,7 @@ public class StreamingUpdateSolrServer extends CommonsHttpSolrServer
|
|||
msg.append( "request: "+method.getURI() );
|
||||
handleError( new Exception( msg.toString() ) );
|
||||
}
|
||||
} while( ! queue.isEmpty());
|
||||
}
|
||||
catch (Throwable e) {
|
||||
handleError( e );
|
||||
|
@ -166,6 +168,7 @@ public class StreamingUpdateSolrServer extends CommonsHttpSolrServer
|
|||
finally {
|
||||
try {
|
||||
// make sure to release the connection
|
||||
if(method != null)
|
||||
method.releaseConnection();
|
||||
}
|
||||
catch( Exception ex ){}
|
||||
|
@ -212,11 +215,11 @@ public class StreamingUpdateSolrServer extends CommonsHttpSolrServer
|
|||
|
||||
queue.put( req );
|
||||
|
||||
synchronized( runners ) {
|
||||
if( runners.isEmpty()
|
||||
|| (queue.remainingCapacity() < queue.size()
|
||||
&& runners.size() < threadCount) )
|
||||
{
|
||||
synchronized( runners ) {
|
||||
Runner r = new Runner();
|
||||
scheduler.execute( r );
|
||||
runners.add( r );
|
||||
|
|
Loading…
Reference in New Issue