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
|
* SOLR-1667: PatternTokenizer does not reset attributes such as positionIncrementGap
|
||||||
(Robert Muir via shalin)
|
(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
|
Other Changes
|
||||||
----------------------
|
----------------------
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,7 @@ public class StreamingUpdateSolrServer extends CommonsHttpSolrServer
|
||||||
log.info( "starting runner: {}" , this );
|
log.info( "starting runner: {}" , this );
|
||||||
PostMethod method = null;
|
PostMethod method = null;
|
||||||
try {
|
try {
|
||||||
|
do {
|
||||||
RequestEntity request = new RequestEntity() {
|
RequestEntity request = new RequestEntity() {
|
||||||
// we don't know the length
|
// we don't know the length
|
||||||
public long getContentLength() { return -1; }
|
public long getContentLength() { return -1; }
|
||||||
|
@ -159,6 +160,7 @@ public class StreamingUpdateSolrServer extends CommonsHttpSolrServer
|
||||||
msg.append( "request: "+method.getURI() );
|
msg.append( "request: "+method.getURI() );
|
||||||
handleError( new Exception( msg.toString() ) );
|
handleError( new Exception( msg.toString() ) );
|
||||||
}
|
}
|
||||||
|
} while( ! queue.isEmpty());
|
||||||
}
|
}
|
||||||
catch (Throwable e) {
|
catch (Throwable e) {
|
||||||
handleError( e );
|
handleError( e );
|
||||||
|
@ -166,6 +168,7 @@ public class StreamingUpdateSolrServer extends CommonsHttpSolrServer
|
||||||
finally {
|
finally {
|
||||||
try {
|
try {
|
||||||
// make sure to release the connection
|
// make sure to release the connection
|
||||||
|
if(method != null)
|
||||||
method.releaseConnection();
|
method.releaseConnection();
|
||||||
}
|
}
|
||||||
catch( Exception ex ){}
|
catch( Exception ex ){}
|
||||||
|
@ -212,11 +215,11 @@ public class StreamingUpdateSolrServer extends CommonsHttpSolrServer
|
||||||
|
|
||||||
queue.put( req );
|
queue.put( req );
|
||||||
|
|
||||||
|
synchronized( runners ) {
|
||||||
if( runners.isEmpty()
|
if( runners.isEmpty()
|
||||||
|| (queue.remainingCapacity() < queue.size()
|
|| (queue.remainingCapacity() < queue.size()
|
||||||
&& runners.size() < threadCount) )
|
&& runners.size() < threadCount) )
|
||||||
{
|
{
|
||||||
synchronized( runners ) {
|
|
||||||
Runner r = new Runner();
|
Runner r = new Runner();
|
||||||
scheduler.execute( r );
|
scheduler.execute( r );
|
||||||
runners.add( r );
|
runners.add( r );
|
||||||
|
|
Loading…
Reference in New Issue