Author: tolusha
Date: 2012-03-28 03:43:43 -0400 (Wed, 28 Mar 2012)
New Revision: 5974
Modified:
jcr/branches/1.14.x/patch/1.14.8-GA/JCR-1725/JCR-1725.patch
Log:
JCR-1725: patch updated
Modified: jcr/branches/1.14.x/patch/1.14.8-GA/JCR-1725/JCR-1725.patch
===================================================================
--- jcr/branches/1.14.x/patch/1.14.8-GA/JCR-1725/JCR-1725.patch 2012-03-28 07:22:01 UTC
(rev 5973)
+++ jcr/branches/1.14.x/patch/1.14.8-GA/JCR-1725/JCR-1725.patch 2012-03-28 07:43:43 UTC
(rev 5974)
@@ -2,7 +2,15 @@
===================================================================
---
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java (revision
5970)
+++
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java (working
copy)
-@@ -81,8 +81,20 @@
+@@ -53,7 +53,6 @@
+ import org.exoplatform.services.jcr.impl.Constants;
+ import org.exoplatform.services.jcr.impl.backup.ResumeException;
+ import org.exoplatform.services.jcr.impl.backup.SuspendException;
+-import org.exoplatform.services.jcr.impl.backup.Suspendable;
+ import org.exoplatform.services.jcr.impl.checker.InspectionReport;
+ import org.exoplatform.services.jcr.impl.core.LocationFactory;
+ import org.exoplatform.services.jcr.impl.core.SessionDataManager;
+@@ -81,8 +80,20 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.security.PrivilegedAction;
@@ -24,7 +32,16 @@
import javax.jcr.RepositoryException;
import javax.jcr.query.InvalidQueryException;
-@@ -202,7 +214,7 @@
+@@ -94,7 +105,7 @@
+ * Implements a {@link org.apache.jackrabbit.core.query.QueryHandler} using
+ * Lucene.
+ */
+-public class SearchIndex extends AbstractQueryHandler implements IndexerIoModeListener,
Suspendable
++public class SearchIndex extends AbstractQueryHandler implements IndexerIoModeListener
+ {
+
+ private static final DefaultQueryNodeFactory DEFAULT_QUERY_NODE_FACTORY = new
DefaultQueryNodeFactory();
+@@ -202,7 +213,7 @@
* Default name of the error log file
*/
private static final String ERROR_LOG = "error.log";
@@ -33,7 +50,7 @@
/**
* The actual index
*/
-@@ -464,12 +476,12 @@
+@@ -464,12 +475,12 @@
* Indicates if this <code>SearchIndex</code> is closed and cannot be
used
* anymore.
*/
@@ -48,7 +65,7 @@
/**
* Text extractor for extracting text content of binary properties.
-@@ -516,12 +528,12 @@
+@@ -516,12 +527,12 @@
/**
* Waiting query execution until resume.
*/
@@ -63,7 +80,7 @@
protected final Set<String> recoveryFilterClasses;
-@@ -1237,7 +1249,7 @@
+@@ -1237,7 +1248,7 @@
*/
public void close()
{
@@ -72,18 +89,16 @@
{
// cleanup resources obtained by filters
if (recoveryFilters != null)
-@@ -1268,7 +1280,9 @@
+@@ -1268,7 +1279,7 @@
errorLog.close();
index.close();
getContext().destroy();
- closed = true;
+ closed.set(true);
-+ resumeWaitingThreads();
-+
log.info("Index closed: " + path);
}
}
-@@ -1546,7 +1560,7 @@
+@@ -1546,7 +1557,7 @@
protected IndexReader getIndexReader(boolean includeSystemIndex) throws IOException
{
// deny query execution if index in offline mode and allowQuery is false
@@ -92,7 +107,7 @@
{
throw new IndexOfflineIOException("Index is offline");
}
-@@ -3202,7 +3216,7 @@
+@@ -3202,7 +3213,7 @@
*/
private void checkOpen() throws IOException
{
@@ -101,7 +116,7 @@
{
throw new IOException("query handler closed and cannot be used
anymore.");
}
-@@ -3358,11 +3372,11 @@
+@@ -3358,11 +3369,11 @@
checkOpen();
if (isOnline)
{
@@ -115,7 +130,7 @@
}
index.setOnline(isOnline, dropStaleIndexes);
}
-@@ -3380,10 +3394,10 @@
+@@ -3380,10 +3391,10 @@
*/
public void suspend() throws SuspendException
{
@@ -128,7 +143,7 @@
}
/**
-@@ -3393,12 +3407,12 @@
+@@ -3393,12 +3404,12 @@
{
try
{
@@ -144,7 +159,7 @@
}
catch (IOException e)
{
-@@ -3415,7 +3429,7 @@
+@@ -3415,7 +3426,7 @@
*/
public boolean isSuspended()
{
@@ -153,7 +168,7 @@
}
/**
-@@ -3426,11 +3440,11 @@
+@@ -3426,11 +3437,11 @@
*/
private void waitForResuming() throws IOException
{
@@ -167,25 +182,25 @@
}
catch (InterruptedException e)
{
-@@ -3440,6 +3454,18 @@
+@@ -3440,11 +3451,15 @@
}
/**
+- * {@inheritDoc}
+ * Count down latcher which makes for resuming all
+ * waiting threads.
-+ */
-+ private void resumeWaitingThreads()
-+ {
+ */
+- public int getPriority()
++ public void resumeWaitingThreads()
+ {
+- return PRIORITY_NORMAL;
+ if (latcher.get() != null)
+ {
+ latcher.get().countDown();
+ }
-+ }
-+
-+ /**
- * {@inheritDoc}
- */
- public int getPriority()
+ }
+
+ /**
Index:
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
===================================================================
---
exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java (revision
5970)
@@ -461,8 +476,20 @@
{
parentSearchManager.suspend();
}
-@@ -1202,7 +1203,7 @@
+@@ -698,6 +699,11 @@
+
+ public void stop()
{
++ if (handler instanceof SearchIndex)
++ {
++ ((SearchIndex)handler).resumeWaitingThreads();
++ }
++
+ handler.close();
+ // ChangesFiler instance is one for both SearchManagers and close() must be
invoked only once,
+ if (parentSearchManager != null)
+@@ -1202,7 +1208,7 @@
+ {
if (rpcService != null)
{
- isResponsibleForResuming = true;
@@ -470,7 +497,7 @@
try
{
-@@ -1228,7 +1229,7 @@
+@@ -1228,7 +1234,7 @@
*/
public boolean isSuspended()
{
@@ -479,7 +506,7 @@
}
/**
-@@ -1275,7 +1276,7 @@
+@@ -1275,7 +1281,7 @@
throw new ResumeException(e);
}
@@ -488,7 +515,7 @@
}
else
{
-@@ -1303,10 +1304,10 @@
+@@ -1303,10 +1309,10 @@
throw new IllegalStateException(
"Index is not in READ_WRITE mode and reindexing can't be launched.
Please start reindexing on coordinator node.");
}
@@ -501,7 +528,7 @@
}
log.info("Starting hot reindexing on the " +
handler.getContext().getRepositoryName() + "/"
-@@ -1321,7 +1322,7 @@
+@@ -1321,7 +1327,7 @@
hotReindexingState = "Running. Started at " +
sdf.format(Calendar.getInstance().getTime());
try
{
@@ -510,7 +537,7 @@
// set offline cluster wide (will make merger disposed and volatile
flushed)
if (rpcService != null && changesFilter.isShared())
{
-@@ -1399,7 +1400,7 @@
+@@ -1399,7 +1405,7 @@
hotReindexingState = "Stopped with errors at " +
sdf.format(Calendar.getInstance().getTime());
log.info("Reindexing halted with errors.");
}
@@ -519,7 +546,7 @@
}
}
}, "HotReindexing-" + handler.getContext().getRepositoryName() +
"-"
-@@ -1512,7 +1513,7 @@
+@@ -1512,7 +1518,7 @@
public Serializable execute(Serializable[] args) throws Throwable
{
@@ -528,16 +555,18 @@
}
});
-@@ -1542,27 +1543,27 @@
+@@ -1542,27 +1548,27 @@
throw new SuspendException("Can't suspend index, while reindexing in
progeress.");
}
- if (!isSuspended)
+ if (!isSuspended.get())
{
- if (handler instanceof Suspendable)
+- if (handler instanceof Suspendable)
++ if (handler instanceof SearchIndex)
{
- ((Suspendable)handler).suspend();
+- ((Suspendable)handler).suspend();
++ ((SearchIndex)handler).suspend();
}
- isSuspended = true;
@@ -550,9 +579,11 @@
- if (isSuspended)
+ if (isSuspended.get())
{
- if (handler instanceof Suspendable)
+- if (handler instanceof Suspendable)
++ if (handler instanceof SearchIndex)
{
- ((Suspendable)handler).resume();
+- ((Suspendable)handler).resume();
++ ((SearchIndex)handler).resume();
}
- isSuspended = false;
@@ -560,7 +591,7 @@
}
}
-@@ -1571,7 +1572,7 @@
+@@ -1571,7 +1577,7 @@
*/
public void onChange(TopologyChangeEvent event)
{