mcardle     2005/11/18 17:21:23 CET

  Modified files:
    src/org/jahia/esi/cache FragmentCache.java 
  Log:
  * temporarily synchronized access
  
  Revision  Changes    Path
  1.6       +9 -9      esi_server/src/org/jahia/esi/cache/FragmentCache.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/esi_server/src/org/jahia/esi/cache/FragmentCache.java.diff?r1=1.5&r2=1.6&f=h
  
  
  
  Index: FragmentCache.java
  ===================================================================
  RCS file: 
/home/cvs/repository/esi_server/src/org/jahia/esi/cache/FragmentCache.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FragmentCache.java        8 Nov 2005 10:53:25 -0000       1.5
  +++ FragmentCache.java        18 Nov 2005 16:21:23 -0000      1.6
  @@ -58,7 +58,7 @@
          base64 = new Base64();
       }
   
  -    public HashMap getHashCache() {
  +    public synchronized HashMap getHashCache() {
           return hashCache;
       }
   
  @@ -203,7 +203,7 @@
           }
       }
   
  -    public boolean contains(String urlKey ) {
  +    public synchronized boolean contains(String urlKey ) {
   
           UrlCacheObject urlObj = (UrlCacheObject) hashCache.get(urlKey);
   
  @@ -250,7 +250,7 @@
           return false;
       }
   
  -    public CacheObject get(String urlKey) {
  +    public synchronized CacheObject get(String urlKey) {
           if ( hashCache.containsKey(urlKey) ) { //this check shouldn't be 
necessary since we should've called contains beforehand
   
               UrlCacheObject urlObj = (UrlCacheObject) hashCache.get(urlKey);
  @@ -263,15 +263,15 @@
           return null;
       }
   
  -    public void remove(String urlKey) {
  +    public synchronized void remove(String urlKey) {
           if ( hashCache.containsKey(urlKey) ) { //this check shouldn't be 
necessary since we should've called contains beforehand
               UrlCacheObject urlObj = (UrlCacheObject) hashCache.get(urlKey);
               remove(urlObj, urlKey);
           } else
  -            log.error("IMPOSSIBLE----------------------------");
  +            log.error("IMPOSSIBLE---------------------------- trying to 
remove none existent : "+urlKey );
       }
   
  -    public void remove(UrlCacheObject urlObj, String urlKey) {
  +    public synchronized void remove(UrlCacheObject urlObj, String urlKey) {
   
           ContentCacheObject contentObj = (ContentCacheObject) 
contentCache.get(urlObj.getContentHash());
   
  @@ -280,7 +280,7 @@
               log.debug("Removing unreferenced ["+contentObj+"]");
               contentCache.remove(urlObj.getContentHash());
           } else if (contentObj.getReferenceCount()<1) {
  -            log.error("IMPOSSIBLE----------------------------");
  +            log.error("IMPOSSIBLE---------------------------- reference 
count is Negative/0 and shouldn't ["+contentObj.getReferenceCount()+"] for " + 
urlKey);
           }
   
           //Remove all referenced objects (only if referenceCount is 0)
  @@ -328,11 +328,11 @@
           return MD5.asHex(content).toString();
       }
   
  -    public HashMap getContentCache() {
  +    public synchronized HashMap getContentCache() {
           return contentCache;
       }
   
  -    public HashMap getUrlCache() {
  +    public synchronized HashMap getUrlCache() {
           return hashCache;
       }
   
  

Reply via email to