Apache Lucene open-source search software
SOLR-1711: StreamingUpdateSolrServer race
Yonik Seeley05a802b3eb36
diff --git a/CHANGES.txt b/CHANGES.txtindex a517b0aae9a..7b185ddbfe9 100644--- a/CHANGES.txt+++ b/CHANGES.txt@@ -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----------------------diff --git a/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java b/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.javaindex b328c861848..8254b93dacf 100644--- a/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java+++ b/src/solrj/org/apache/solr/client/solrj/impl/StreamingUpdateSolrServer.java@@ -99,6 +99,7 @@ public class StreamingUpdateSolrServer extends CommonsHttpSolrServerlog.info( "starting runner: {}" , this );PostMethod method = null;try {+ do {RequestEntity request = new RequestEntity() {// we don't know the lengthpublic long getContentLength() { return -1; }@@ -159,6 +160,7 @@ public class StreamingUpdateSolrServer extends CommonsHttpSolrServermsg.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 CommonsHttpSolrServerfinally {try {// make sure to release the connection+ if(method != null)method.releaseConnection();}catch( Exception ex ){}@@ -212,11 +215,11 @@ public class StreamingUpdateSolrServer extends CommonsHttpSolrServerqueue.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 );