[exo-jcr-commits] exo-jcr SVN: r4182 - 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
Mon Mar 28 09:44:44 EDT 2011


Author: tolusha
Date: 2011-03-28 09:44:44 -0400 (Mon, 28 Mar 2011)
New Revision: 4182

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java
Log:
EXOJCR-1275: close error log at suspend

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	2011-03-28 13:21:37 UTC (rev 4181)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/lucene/SearchIndex.java	2011-03-28 13:44:44 UTC (rev 4182)
@@ -679,8 +679,8 @@
             new Integer(getIndexFormatVersion().getVersion()));
       }
 
-      File file = new File(indexDirectory, ERROR_LOG);
-      errorLog = new ErrorLog(file, errorLogfileSize);
+      doInitErrorLog();
+
       // reprocess any notfinished notifies;
       if (modeHandler.getMode() == IndexerIoMode.READ_WRITE)
       {
@@ -2837,6 +2837,15 @@
       errorLog.writeChanges(removed, added);
    }
 
+   /**
+    * Initialization error log.
+    */
+   private void doInitErrorLog() throws IOException
+   {
+      File file = new File(new File(path), ERROR_LOG);
+      errorLog = new ErrorLog(file, errorLogfileSize);
+   }
+
    private void recoverErrorLog(ErrorLog errlog) throws IOException, RepositoryException
    {
       final Set<String> rem = new HashSet<String>();
@@ -2967,6 +2976,8 @@
     */
    public void suspend() throws SuspendException
    {
+      errorLog.close();
+
       if (index instanceof Suspendable)
       {
          ((Suspendable)index).suspend();
@@ -2978,6 +2989,15 @@
     */
    public void resume() throws ResumeException
    {
+      try
+      {
+         doInitErrorLog();
+      }
+      catch (IOException e)
+      {
+         throw new ResumeException(e);
+      }
+
       if (index instanceof Suspendable)
       {
          ((Suspendable)index).resume();



More information about the exo-jcr-commits mailing list