You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/02/21 19:57:57 UTC

svn commit: r510148 - in /lenya/trunk/src: impl/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java java/org/apache/lenya/cms/repository/SessionImpl.java java/org/apache/lenya/cms/repository/SharedItemStore.java

Author: andreas
Date: Wed Feb 21 10:57:57 2007
New Revision: 510148

URL: http://svn.apache.org/viewvc?view=rev&rev=510148
Log:
Refresh shared item store actively to avoid 404s because of limited filesystem last modification granularity

Modified:
    lenya/trunk/src/impl/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java
    lenya/trunk/src/java/org/apache/lenya/cms/repository/SharedItemStore.java

Modified: lenya/trunk/src/impl/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/impl/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java?view=diff&rev=510148&r1=510147&r2=510148
==============================================================================
--- lenya/trunk/src/impl/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java (original)
+++ lenya/trunk/src/impl/java/org/apache/lenya/cms/repository/SharedItemStoreImpl.java Wed Feb 21 10:57:57 2007
@@ -35,14 +35,14 @@
 public class SharedItemStoreImpl extends AbstractLogEnabled implements SharedItemStore, ThreadSafe {
 
     private IdentityMap map;
-    
-    protected IdentityMap getIdentityMap() {
+
+    protected synchronized IdentityMap getIdentityMap() {
         if (this.map == null) {
             this.map = new IdentityMapImpl(getLogger());
         }
         return this.map;
     }
-    
+
     public void addListener(RepositoryListener listener) throws RepositoryException {
         throw new IllegalStateException("Operation not permitted.");
     }
@@ -59,7 +59,8 @@
         throw new IllegalStateException("Operation not permitted.");
     }
 
-    public RepositoryItem getRepositoryItem(RepositoryItemFactory factory, String key) throws RepositoryException {
+    public RepositoryItem getRepositoryItem(RepositoryItemFactory factory, String key)
+            throws RepositoryException {
         RepositoryItemFactoryWrapper wrapper = new RepositoryItemFactoryWrapper(factory, this);
         return (RepositoryItem) getIdentityMap().get(wrapper, key);
     }
@@ -104,4 +105,8 @@
         throw new IllegalStateException("Operation not permitted.");
     }
 
+    public synchronized void clear() {
+        this.map = null;
+    }
+    
 }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java?view=diff&rev=510148&r1=510147&r2=510148
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SessionImpl.java Wed Feb 21 10:57:57 2007
@@ -110,6 +110,7 @@
 
         try {
             getUnitOfWork().commit();
+            getSharedItemStore().clear();
         } catch (TransactionException e) {
             throw new RepositoryException(e);
         }

Modified: lenya/trunk/src/java/org/apache/lenya/cms/repository/SharedItemStore.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/java/org/apache/lenya/cms/repository/SharedItemStore.java?view=diff&rev=510148&r1=510147&r2=510148
==============================================================================
--- lenya/trunk/src/java/org/apache/lenya/cms/repository/SharedItemStore.java (original)
+++ lenya/trunk/src/java/org/apache/lenya/cms/repository/SharedItemStore.java Wed Feb 21 10:57:57 2007
@@ -26,5 +26,10 @@
      * The service role.
      */
     String ROLE = SharedItemStore.class.getName();
+    
+    /**
+     * Clears the store when a session has been committed.
+     */
+    void clear();
 
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org