[exo-jcr-commits] exo-jcr SVN: r1575 - jcr/trunk/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 Jan 26 05:39:57 EST 2010
Author: skabashnyuk
Date: 2010-01-26 05:39:57 -0500 (Tue, 26 Jan 2010)
New Revision: 1575
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java
Log:
EXOJCR-397 : Do nothing in read_only mode
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 2010-01-26 08:42:43 UTC (rev 1574)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/MultiIndex.java 2010-01-26 10:39:57 UTC (rev 1575)
@@ -166,7 +166,7 @@
* The time this index was last flushed or a transaction was committed.
*/
private long lastFileSystemFlushTime;
-
+
/**
* The <code>IndexMerger</code> for this <code>MultiIndex</code>.
*/
@@ -889,55 +889,58 @@
*/
void close()
{
+ if (modeHandler.getMode().equals(IndexerIoMode.READ_WRITE))
+ {
- // stop index merger
- // when calling this method we must not lock this MultiIndex, otherwise
- // a deadlock might occur
- merger.dispose();
+ // stop index merger
+ // when calling this method we must not lock this MultiIndex, otherwise
+ // a deadlock might occur
+ merger.dispose();
- synchronized (this)
- {
- // stop timer
- if (flushTask != null)
+ synchronized (this)
{
- flushTask.cancel();
- }
+ // stop timer
+ if (flushTask != null)
+ {
+ flushTask.cancel();
+ }
- // commit / close indexes
- try
- {
- releaseMultiReader();
- }
- catch (IOException e)
- {
- log.error("Exception while closing search index.", e);
- }
- try
- {
- flush();
- }
- catch (IOException e)
- {
- log.error("Exception while closing search index.", e);
- }
- volatileIndex.close();
- for (int i = 0; i < indexes.size(); i++)
- {
- ((PersistentIndex)indexes.get(i)).close();
- }
+ // commit / close indexes
+ try
+ {
+ releaseMultiReader();
+ }
+ catch (IOException e)
+ {
+ log.error("Exception while closing search index.", e);
+ }
+ try
+ {
+ flush();
+ }
+ catch (IOException e)
+ {
+ log.error("Exception while closing search index.", e);
+ }
+ volatileIndex.close();
+ for (int i = 0; i < indexes.size(); i++)
+ {
+ ((PersistentIndex)indexes.get(i)).close();
+ }
- // close indexing queue
- indexingQueue.close();
+ // close indexing queue
+ indexingQueue.close();
- // finally close directory
- try
- {
- indexDir.close();
+ // finally close directory
+ try
+ {
+ indexDir.close();
+ }
+ catch (IOException e)
+ {
+ log.error("Exception while closing directory.", e);
+ }
}
- catch (IOException e)
- {
- log.error("Exception while closing directory.", e);
- }
}
}
@@ -989,9 +992,13 @@
{
ItemData data = handler.getContext().getItemStateManager().getItemData(id);
if (data == null)
+ {
throw new ItemNotFoundException("Item id=" + id + " not found");
+ }
if (!data.isNode())
+ {
throw new RepositoryException("Item with id " + id + " is not a node");
+ }
return createDocument((NodeData)data);
}
@@ -1065,7 +1072,7 @@
}
}
executeAndLog(new Commit(getTransactionId()));
-
+
indexNames.write();
// reset redo log
@@ -2465,11 +2472,11 @@
while (iterator.hasNext())
{
PersistentIndex index = iterator.next();
- String name = ((PersistentIndex)index).getName();
+ String name = index.getName();
// if current index not in new list, close it, cause it is deleted.
if (!newList.contains(name))
{
- ((PersistentIndex)index).close();
+ index.close();
iterator.remove();
}
else
More information about the exo-jcr-commits
mailing list