[exo-jcr-commits] exo-jcr SVN: r5674 - in jcr/trunk: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query and 2 other directories.
do-not-reply at jboss.org
do-not-reply at jboss.org
Tue Feb 21 04:43:56 EST 2012
Author: andrew.plotnikov
Date: 2012-02-21 04:43:54 -0500 (Tue, 21 Feb 2012)
New Revision: 5674
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/QueryHandlerParams.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchIndexConfigurationHelper.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml
Log:
EXOJCR-1770: Allowed to configure the total amount of indexing threads
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/QueryHandlerParams.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/QueryHandlerParams.java 2012-02-20 15:17:24 UTC (rev 5673)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/config/QueryHandlerParams.java 2012-02-21 09:43:54 UTC (rev 5674)
@@ -119,4 +119,6 @@
public static final String PARAM_INDEX_RECOVERY_FILTER = "index-recovery-filter";
+ public static final String PARAM_INDEXING_THREAD_POOL_SIZE = "indexing-thread-pool-size";
+
}
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchIndexConfigurationHelper.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchIndexConfigurationHelper.java 2012-02-20 15:17:24 UTC (rev 5673)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchIndexConfigurationHelper.java 2012-02-21 09:43:54 UTC (rev 5674)
@@ -206,6 +206,10 @@
{
searchIndex.addRecoveryFilterClass(value);
}
+ else if (QueryHandlerParams.PARAM_INDEXING_THREAD_POOL_SIZE.equals(name))
+ {
+ searchIndex.setIndexingThreadPoolSize(Integer.parseInt(value));
+ }
else
{
searchIndex.addOptionalParameter(name, value);
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2012-02-20 15:17:24 UTC (rev 5673)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2012-02-21 09:43:54 UTC (rev 5674)
@@ -3520,7 +3520,7 @@
/**
* The total amount of threads used for the indexing
*/
- private final int nThreads = Runtime.getRuntime().availableProcessors();
+ private final int nThreads = handler.getIndexingThreadPoolSize();
/**
* The {@link CountDownLatch} used to notify that the indexing is over
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2012-02-20 15:17:24 UTC (rev 5673)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java 2012-02-21 09:43:54 UTC (rev 5674)
@@ -192,6 +192,11 @@
*/
public static final boolean DEFAULT_ASYNC_REINDEXING = false;
+ /**
+ * The default value for {@link #indexingThreadPoolSize}
+ */
+ private static final Integer DEFAULT_INDEXING_THREAD_POOL_SIZE = Runtime.getRuntime().availableProcessors();
+
/**
* The default value for {@link #indexRecoveryMode}.
*/
@@ -206,7 +211,7 @@
* Default name of the error log file
*/
private static final String ERROR_LOG = "error.log";
-
+
/**
* The actual index
*/
@@ -533,6 +538,8 @@
protected Map<String, String> optionalParameters = new HashMap<String, String>();
+ protected Integer indexingThreadPoolSize = DEFAULT_INDEXING_THREAD_POOL_SIZE;
+
/**
* Working constructor.
*
@@ -3435,4 +3442,20 @@
{
return PRIORITY_NORMAL;
}
+
+ /**
+ * @return the indexingThreadPoolSize
+ */
+ public Integer getIndexingThreadPoolSize()
+ {
+ return indexingThreadPoolSize;
+ }
+
+ /**
+ * @param indexingThreadPoolSize the indexingThreadPoolSize to set
+ */
+ public void setIndexingThreadPoolSize(Integer indexingThreadPoolSize)
+ {
+ this.indexingThreadPoolSize = indexingThreadPoolSize;
+ }
}
Modified: jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml
===================================================================
--- jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml 2012-02-20 15:17:24 UTC (rev 5673)
+++ jcr/trunk/exo.jcr.docs/exo.jcr.docs.developer/en/src/main/docbook/en-US/modules/jcr/query-handler-config.xml 2012-02-21 09:43:54 UTC (rev 5674)
@@ -25,7 +25,7 @@
<mediaobject>
<imageobject>
<imagedata align="center"
- fileref="images/diagram-standalone-index.png" />
+ fileref="images/diagram-standalone-index.png"/>
</imageobject>
</mediaobject>
@@ -41,7 +41,7 @@
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/diagram-local-index.png" />
+ <imagedata align="center" fileref="images/diagram-local-index.png"/>
</imageobject>
</mediaobject>
@@ -64,7 +64,7 @@
<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/diagram-shared-index.png" />
+ <imagedata align="center" fileref="images/diagram-shared-index.png"/>
</imageobject>
</mediaobject>
@@ -108,6 +108,7 @@
<property name="reindexing-page-size" value="1000" />
<property name="index-recovery-mode" value="from-coordinator" />
<property name="index-recovery-filter" value="org.exoplatform.services.jcr.impl.core.query.lucene.DocNumberRecoveryFilter" />
+ <property name="indexing-thread-pool-size" value="16" />
</properties>
</query-handler>
</workspace>
@@ -213,6 +214,12 @@
flag set, indexing will be launched asynchronously, without
blocking the JCR. Default is "false".</entry>
</row>
+
+ <row>
+ <entry>indexing-thread-pool-size</entry>
+
+ <entry>Define the total amount of indexing threads.</entry>
+ </row>
</tbody>
</tgroup>
</table>
@@ -460,11 +467,11 @@
<para>"OFFLINE" state means that index is currently re-creating. When
state changed, corresponding log event is printed. From the start of
background task index is switched to "OFFLINE", with following log event
- : </para>
+ :</para>
<programlisting>[INFO] Setting index OFFLINE (repository/production[system]).</programlisting>
- <para>When process finished, two events are logged : </para>
+ <para>When process finished, two events are logged :</para>
<programlisting>[INFO] Created initial index for 143018 nodes (repository/production[system]).
[INFO] Setting index ONLINE (repository/production[system]).</programlisting>
@@ -486,7 +493,7 @@
blocking whole application by using any JMX-compatible console (see
screenshot below, "JConsole in action").<mediaobject>
<imageobject>
- <imagedata align="center" fileref="images/jmx-jconsole.png" />
+ <imagedata align="center" fileref="images/jmx-jconsole.png"/>
</imageobject>
</mediaobject>Server can continue working as expected while index is
recreated. This depends on the flag "allow queries", passed via JMX
More information about the exo-jcr-commits
mailing list