[exo-jcr-commits] exo-jcr SVN: r1340 - jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent.

do-not-reply at jboss.org do-not-reply at jboss.org
Mon Jan 11 07:05:36 EST 2010


Author: sergiykarpenko
Date: 2010-01-11 07:05:35 -0500 (Mon, 11 Jan 2010)
New Revision: 1340

Modified:
   jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
   jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
Log:
EXOJCR-376: removed redundant methods

Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java	2010-01-11 11:39:43 UTC (rev 1339)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/CacheableWorkspaceDataManager.java	2010-01-11 12:05:35 UTC (rev 1340)
@@ -202,8 +202,7 @@
             transactionManager.begin();
             transactionManager.setTransactionTimeout(20);
             cache.beginTransaction();
-            // save changes and notify only txAware listeners
-            super.saveInTransaction(changesLog);
+            super.save(changesLog);
             cache.commitTransaction();
             transactionManager.commit();
          }
@@ -241,9 +240,9 @@
             e.printStackTrace();
             throw new RepositoryException(e.getLocalizedMessage(), e.getCause());
          }
-         // notify listeners after transaction commit         
-         super.postTransactionNotify(changesLog);
       }
+      // notify listeners after transaction commit         
+      super.notifySaveItems(changesLog, false);
    }
 
    /**

Modified: jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java
===================================================================
--- jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java	2010-01-11 11:39:43 UTC (rev 1339)
+++ jcr/branches/1.12.0-JBCCACHE/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/dataflow/persistent/WorkspacePersistentDataManager.java	2010-01-11 12:05:35 UTC (rev 1340)
@@ -119,33 +119,10 @@
    public void save(final ItemStateChangesLog changesLog) throws RepositoryException
    {
       doSave(changesLog);
-      notifySaveItems(changesLog);
+      notifySaveItems(changesLog, true);
    }
 
    /**
-    * Saves the list of changes from this storage. And notifies listeners that are transaction aware.
-    * 
-    * @param changesLog
-    * @throws RepositoryException
-    */
-   public void saveInTransaction(final ItemStateChangesLog changesLog) throws RepositoryException
-   {
-      doSave(changesLog);
-      notifySaveItemsOnTransaction(changesLog, true);
-   }
-
-   /**
-    * Notifies listeners that are not transaction aware. 
-    * Must be called after transaction commit.
-    * 
-    * @param changesLog 
-    */
-   public void postTransactionNotify(final ItemStateChangesLog changesLog)
-   {
-      notifySaveItemsOnTransaction(changesLog, false);
-   }
-
-   /**
     * Save the list of changes to storage.
     * 
     * @param changesLog
@@ -592,40 +569,24 @@
    }
 
    /**
-    * Notify all listeners about current changes log persistent state.
+    * Notify listeners about current changes log persistent state.
+    * Listeners notified according to is listener transaction aware.
     * 
     * @param changesLog
     *          ItemStateChangesLog
+    * @param isListenerTXAware - is listeners notified in transaction, or after transaction
     */
-   protected void notifySaveItems(final ItemStateChangesLog changesLog)
+   protected void notifySaveItems(final ItemStateChangesLog changesLog, boolean isListenerTXAware)
    {
       for (MandatoryItemsPersistenceListener mlistener : mandatoryListeners)
-         mlistener.onSaveItems(changesLog);
-
-      for (ItemsPersistenceListener listener : listeners)
       {
-         if (isListenerAccepted(listener))
-            listener.onSaveItems(changesLog);
-      }
-   }
-
-   /**
-    * Notify listeners according to isTransaction parameter and is listener transaction aware. 
-    * 
-    * @param changesLog - Changes log to notify listeners
-    * @param isTransaction - is listeners notified in transaction, or after transaction 
-    */
-   protected void notifySaveItemsOnTransaction(final ItemStateChangesLog changesLog, boolean isTransaction)
-   {
-      for (MandatoryItemsPersistenceListener mlistener : mandatoryListeners)
-      {
-         if (mlistener.isTXAware() == isTransaction)
+         if (mlistener.isTXAware() == isListenerTXAware)
             mlistener.onSaveItems(changesLog);
       }
 
       for (ItemsPersistenceListener listener : listeners)
       {
-         if (listener.isTXAware() == isTransaction && isListenerAccepted(listener))
+         if (listener.isTXAware() == isListenerTXAware && isListenerAccepted(listener))
             listener.onSaveItems(changesLog);
       }
    }



More information about the exo-jcr-commits mailing list