[exo-jcr-commits] exo-jcr SVN: r5577 - jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Feb 7 10:45:59 EST 2012
Author: tolusha
Date: 2012-02-07 10:45:59 -0500 (Tue, 07 Feb 2012)
New Revision: 5577
Modified:
jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java
Log:
EXOJCR-1713: remove parallel text extractions
Modified: jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java
===================================================================
--- jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java 2012-02-07 15:18:44 UTC (rev 5576)
+++ jcr/branches/1.15.x/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/AbstractIndex.java 2012-02-07 15:45:59 UTC (rev 5577)
@@ -163,56 +163,43 @@
void addDocuments(final Document[] docs) throws IOException
{
final IndexWriter writer = getIndexWriter();
- DynamicPooledExecutor.Command[] commands = new DynamicPooledExecutor.Command[docs.length];
- for (int i = 0; i < docs.length; i++)
+
+ IOException ioExc = null;
+ try
{
- final Document doc = docs[i];
- // create a command for inverting the document
- commands[i] = new DynamicPooledExecutor.Command()
+ for (Document doc : docs)
{
- public Object call() throws Exception
+ try
{
- long time = System.currentTimeMillis();
writer.addDocument(doc);
- return new Long(System.currentTimeMillis() - time);
}
- };
- }
- DynamicPooledExecutor.Result[] results = EXECUTOR.executeAndWait(commands);
- invalidateSharedReader();
- IOException ex = null;
- for (int i = 0; i < results.length; i++)
- {
- if (results[i].getException() != null)
- {
- Throwable cause = results[i].getException().getCause();
- if (ex == null)
+ catch (Throwable e)
{
- // only throw the first exception
- if (cause instanceof IOException)
+ if (ioExc == null)
{
- ex = (IOException)cause;
+ if (e instanceof IOException)
+ {
+ ioExc = (IOException)e;
+ }
+ else
+ {
+ ioExc = Util.createIOException(e);
+ }
}
- else
- {
- throw Util.createIOException(cause);
- }
+
+ log.warn("Exception while inverting document", e);
}
- else
- {
- // all others are logged
- log.warn("Exception while inverting document", cause);
- }
}
- else
- {
- log.debug("Inverted document in {} ms", results[i].get());
- }
}
- if (ex != null)
+ finally
{
- throw ex;
+ invalidateSharedReader();
}
+
+ if (ioExc != null)
+ {
+ throw ioExc;
+ }
}
/**
More information about the exo-jcr-commits
mailing list