[exo-jcr-commits] exo-jcr SVN: r6010 - in jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl: dataflow/persistent and 1 other directory.

do-not-reply at jboss.org do-not-reply at jboss.org
Tue Apr 3 09:39:46 EDT 2012


Author: areshetnyak
Date: 2012-04-03 09:39:45 -0400 (Tue, 03 Apr 2012)
New Revision: 6010

Modified:
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecovery.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecoveryImpl.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
   jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
Log:
EXOJCR-1842 : The problem with warrnings in RPCService during restore from backup was fixed.

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecovery.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecovery.java	2012-04-03 03:45:09 UTC (rev 6009)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecovery.java	2012-04-03 13:39:45 UTC (rev 6010)
@@ -74,4 +74,9 @@
     * @throws RepositoryException if error occurs.
     */
    public boolean checkIndexReady() throws RepositoryException;
+
+   /**
+    * Frees resources associated with index recovery.
+    */
+   public void close();
 }

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecoveryImpl.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecoveryImpl.java	2012-04-03 03:45:09 UTC (rev 6009)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/IndexRecoveryImpl.java	2012-04-03 13:39:45 UTC (rev 6010)
@@ -482,4 +482,18 @@
       }
    }
 
+   /**
+    * {@inheritDoc}
+    */
+   public void close()
+   {
+      rpcService.unregisterCommand(changeIndexMode);
+      rpcService.unregisterCommand(getIndexList);
+      rpcService.unregisterCommand(getIndexFile);
+      rpcService.unregisterCommand(requestForResponsibleToSetIndexOnline);
+      rpcService.unregisterCommand(checkIndexReady);
+
+      rpcService.unregisterTopologyChangeListener(this);
+   }
+
 }

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java	2012-04-03 03:45:09 UTC (rev 6009)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/core/query/SearchManager.java	2012-04-03 13:39:45 UTC (rev 6010)
@@ -325,11 +325,9 @@
       }
       else
       {
-         doInitRemoteCommands();
-
+         initRemoteCommands();
          this.indexRecovery = new IndexRecoveryImpl(rpcService, this);
          rpcService.registerTopologyChangeListener(this);
-         rpcService.registerTopologyChangeListener((TopologyChangeListener)indexRecovery);
       }
    }
 
@@ -700,6 +698,8 @@
 
    public void stop()
    {
+      indexRecovery.close();
+      
       handler.close();
 
       // ChangesFiler instance is one for both SearchManagers and close() must be invoked only once,  
@@ -707,6 +707,9 @@
       {
          changesFilter.close();
       }
+      
+      unregisterRemoteCommands();
+      
       LOG.info("Search manager stopped");
    }
 
@@ -1468,7 +1471,7 @@
    /**
     * Register remote commands.
     */
-   private void doInitRemoteCommands()
+   private void initRemoteCommands()
    {
       // register commands
       suspend = rpcService.registerCommand(new RemoteCommand()
@@ -1536,6 +1539,22 @@
       });
 
    }
+   
+   /**
+    * Unregister remote commands.
+    */
+   private void unregisterRemoteCommands()
+   {
+      if (rpcService != null)
+      {
+         rpcService.unregisterCommand(suspend);
+         rpcService.unregisterCommand(resume);
+         rpcService.unregisterCommand(requestForResponsibleForResuming);
+         rpcService.unregisterCommand(changeIndexState);
+         
+         rpcService.unregisterTopologyChangeListener(this);
+      }
+   }
 
    protected void suspendLocally() throws SuspendException
    {

Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java	2012-04-03 03:45:09 UTC (rev 6009)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java	2012-04-03 13:39:45 UTC (rev 6010)
@@ -428,7 +428,6 @@
 
       this.rpcService = rpcService;
       this.txResourceManager = txResourceManager;
-      doInitRemoteCommands();
    }
 
    /**
@@ -497,7 +496,6 @@
       addItemPersistenceListener(new CacheItemsPersistenceListener());
       this.rpcService = rpcService;
       this.txResourceManager = txResourceManager;
-      doInitRemoteCommands();
    }
 
    /**
@@ -2071,7 +2069,7 @@
    /**
     * Initialization remote commands.
     */
-   private void doInitRemoteCommands()
+   private void initRemoteCommands()
    {
       if (rpcService != null)
       {
@@ -2126,6 +2124,22 @@
          rpcService.registerTopologyChangeListener(this);
       }
    }
+   
+   /**
+    * Unregister remote commands.
+    */
+   private void unregisterRemoteCommands()
+   {
+      if (rpcService != null)
+      {
+         rpcService.unregisterCommand(suspend);
+         rpcService.unregisterCommand(resume);
+         rpcService.unregisterCommand(requestForResponsibleForResuming);
+         
+         rpcService.unregisterTopologyChangeListener(this);
+      }
+      
+   }
 
    private <T> T executeAction(PrivilegedExceptionAction<T> action) throws RepositoryException
    {
@@ -2369,6 +2383,8 @@
     */
    public void start()
    {
+      initRemoteCommands();
+      
       isStopped.set(false);
 
       try
@@ -2475,6 +2491,8 @@
 
       isStopped.set(true);
       resumeLocally();
+      
+      unregisterRemoteCommands();
    }
 
    /**



More information about the exo-jcr-commits mailing list