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/08/15 18:35:08 UTC

svn commit: r566251 - /lenya/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/SourceCacheImpl.java

Author: andreas
Date: Wed Aug 15 09:35:07 2007
New Revision: 566251

URL: http://svn.apache.org/viewvc?view=rev&rev=566251
Log:
Made SourceCache ThreadSafe

Modified:
    lenya/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/SourceCacheImpl.java

Modified: lenya/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/SourceCacheImpl.java
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/SourceCacheImpl.java?view=diff&rev=566251&r1=566250&r2=566251
==============================================================================
--- lenya/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/SourceCacheImpl.java (original)
+++ lenya/trunk/src/modules-core/cache/java/src/org/apache/lenya/ac/cache/SourceCacheImpl.java Wed Aug 15 09:35:07 2007
@@ -27,6 +27,7 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.thread.ThreadSafe;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceNotFoundException;
 import org.apache.excalibur.source.SourceResolver;
@@ -39,7 +40,7 @@
  */
 public class SourceCacheImpl
     extends AbstractLogEnabled
-    implements SourceCache, Serviceable, Disposable {
+    implements SourceCache, Serviceable, Disposable, ThreadSafe {
 
     /**
      * Returns the service manager.
@@ -80,7 +81,7 @@
     /**
      * @see org.apache.lenya.ac.cache.SourceCache#get(java.lang.String, org.apache.lenya.ac.cache.InputStreamBuilder)
      */
-    public Object get(String sourceUri, InputStreamBuilder builder) throws CachingException {
+    public synchronized Object get(String sourceUri, InputStreamBuilder builder) throws CachingException {
 
         String key = sourceUri;
         Object value = null;
@@ -192,7 +193,7 @@
      * @throws SourceNotFoundException when an error occurs.
      * @throws BuildException if an error occurs.
      */
-    protected Object buildObject(String sourceUri, InputStreamBuilder builder)
+    protected synchronized Object buildObject(String sourceUri, InputStreamBuilder builder)
         throws MalformedURLException, IOException, SourceNotFoundException, BuildException {
         Object value = null;
         Source source = null;
@@ -217,7 +218,7 @@
      * @throws MalformedURLException when an error occurs.
      * @throws IOException when an error occurs.
      */
-    protected SourceValidity getSourceValidity(String sourceUri)
+    protected synchronized SourceValidity getSourceValidity(String sourceUri)
         throws MalformedURLException, IOException {
         SourceValidity sourceValidity;
         Source source = null;



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