db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject cvs commit: db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/guides objectcache.xml
Date Fri, 13 May 2005 18:24:31 GMT
arminw      2005/05/13 11:24:31

  Modified:    contrib/src Tag: OJB_1_0_RELEASE ObjectCacheOSCacheImpl.java
               src/doc/forrest/src/documentation/content/xdocs/docu/guides
                        Tag: OJB_1_0_RELEASE objectcache.xml
  Log:
  fix by Jacques Desmazieres
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.1.4.3   +14 -2     db-ojb/contrib/src/ObjectCacheOSCacheImpl.java
  
  Index: ObjectCacheOSCacheImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/contrib/src/ObjectCacheOSCacheImpl.java,v
  retrieving revision 1.1.4.2
  retrieving revision 1.1.4.3
  diff -u -r1.1.4.2 -r1.1.4.3
  --- ObjectCacheOSCacheImpl.java	7 Feb 2005 20:52:18 -0000	1.1.4.2
  +++ ObjectCacheOSCacheImpl.java	13 May 2005 18:24:31 -0000	1.1.4.3
  @@ -48,11 +48,20 @@
       {
           try
           {
  +            /*
  +            Actually, OSCache sends notifications (Events) only on flush
  +            events. The putInCache method do not flush the cache, so no event is sent.
  +            The ObjectCacheOSCacheInternalImpl should force OSCache to flush the entry
  +            in order to generate an event. This guarantee that other nodes always
  +            in sync with the DB.
  +            Alternative a non-indefinite refresh-period could be used in conjunction
  +            with optimistic-locking for persistent objects.
  +            */
  +            remove(oid);
               admin.putInCache(oid.toString(), obj);
           }
           catch(Exception e)
           {
  -            admin.cancelUpdate(oid.toString());
               log.error("Error while try to cache object: " + oid, e);
           }
       }
  @@ -88,19 +97,22 @@
   
       public Object lookup(Identity oid)
       {
  +        Cache cache = admin.getCache();
           try
           {
  -            return admin.getFromCache(oid.toString(), REFRESH_PERIOD);
  +            return cache.getFromCache(oid.toString(), REFRESH_PERIOD);
           }
           catch(NeedsRefreshException e)
           {
               // not found in cache
               if(log.isDebugEnabled()) log.debug("Not found in cache: " + oid);
  +            cache.cancelUpdate(oid.toString());
               return null;
           }
           catch(Exception e)
           {
               log.error("Unexpected error when lookup object from cache: " + oid, e);
  +            cache.cancelUpdate(oid.toString());
               return null;
           }
       }
  
  
  
  No                   revision
  No                   revision
  1.1.2.5   +15 -3     db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/guides/objectcache.xml
  
  Index: objectcache.xml
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/doc/forrest/src/documentation/content/xdocs/docu/guides/objectcache.xml,v
  retrieving revision 1.1.2.4
  retrieving revision 1.1.2.5
  diff -u -r1.1.2.4 -r1.1.2.5
  --- objectcache.xml	12 Mar 2005 01:07:25 -0000	1.1.2.4
  +++ objectcache.xml	13 May 2005 18:24:31 -0000	1.1.2.5
  @@ -724,11 +724,20 @@
       {
           try
           {
  +            /*
  +            Actually, OSCache sends notifications (Events) only on flush
  +            events. The putInCache method do not flush the cache, so no event is sent.
  +            The ObjectCacheOSCacheInternalImpl should force OSCache to flush the entry
  +            in order to generate an event. This guarantee that other nodes always
  +            in sync with the DB.
  +            Alternative a non-indefinite refresh-period could be used in conjunction
  +            with optimistic-locking for persistent objects.
  +            */
  +            remove(oid);
               admin.putInCache(oid.toString(), obj);
           }
           catch(Exception e)
           {
  -            admin.cancelUpdate(oid.toString());
               log.error("Error while try to cache object: " + oid, e);
           }
       }
  @@ -764,19 +773,22 @@
   
       public Object lookup(Identity oid)
       {
  +        Cache cache = admin.getCache();
           try
           {
  -            return admin.getFromCache(oid.toString(), REFRESH_PERIOD);
  +            return cache.getFromCache(oid.toString(), REFRESH_PERIOD);
           }
           catch(NeedsRefreshException e)
           {
               // not found in cache
               if(log.isDebugEnabled()) log.debug("Not found in cache: " + oid);
  +            cache.cancelUpdate(oid.toString());
               return null;
           }
           catch(Exception e)
           {
               log.error("Unexpected error when lookup object from cache: " + oid, e);
  +            cache.cancelUpdate(oid.toString());
               return null;
           }
       }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message