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/java/org/apache/ojb/broker/cache ObjectCacheDefaultImpl.java
Date Sun, 11 Jan 2004 01:55:15 GMT
arminw      2004/01/10 17:55:15

  Modified:    src/java/org/apache/ojb/broker/cache
                        ObjectCacheDefaultImpl.java
  Log:
  add some log info about objects removed from cache
  when tx was aborted
  
  Revision  Changes    Path
  1.19      +15 -13    db-ojb/src/java/org/apache/ojb/broker/cache/ObjectCacheDefaultImpl.java
  
  Index: ObjectCacheDefaultImpl.java
  ===================================================================
  RCS file: /home/cvs/db-ojb/src/java/org/apache/ojb/broker/cache/ObjectCacheDefaultImpl.java,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -r1.18 -r1.19
  --- ObjectCacheDefaultImpl.java	4 Jan 2004 18:27:31 -0000	1.18
  +++ ObjectCacheDefaultImpl.java	11 Jan 2004 01:55:15 -0000	1.19
  @@ -164,16 +164,16 @@
       public ObjectCacheDefaultImpl(PersistenceBroker broker, Properties prop)
       {
           this.broker = broker;
  -        timeout = prop == null ? timeout : ( Long.parseLong( prop.getProperty(TIMEOUT_PROP,
"" + (60 * 15) ) ) *1000);
  +        timeout = prop == null ? timeout : (Long.parseLong(prop.getProperty(TIMEOUT_PROP,
"" + (60 * 15))) * 1000);
   
           useAutoSync = prop == null ?
  -                false : ( Boolean.valueOf((prop.getProperty(AUTOSYNC_PROP, "false")).trim())).booleanValue();
  -        if(useAutoSync && broker != null)
  +                false : (Boolean.valueOf((prop.getProperty(AUTOSYNC_PROP, "false")).trim())).booleanValue();
  +        if (useAutoSync && broker != null)
           {
               // we add this instance as a permanent PBStateListener
               broker.addListener(this, true);
           }
  -        if(useAutoSync && broker == null)
  +        if (useAutoSync && broker == null)
           {
               LoggerFactory.getDefaultLogger().info("[" + ObjectCacheDefaultImpl.class.getName()
+
                       "] Can't enable " + AUTOSYNC_PROP + ", because given PB instance is
null");
  @@ -268,13 +268,12 @@
   
       protected void finalize()
       {
  -        Logger logger = LoggerFactory.getDefaultLogger();
  -        logger.debug("Finalize ObjectCache: "+this.toString());
  +        LoggerFactory.getDefaultLogger().debug("Finalize ObjectCache: " + this.toString());
       }
   
       private void traceIdentity(Identity oid)
       {
  -        if(useAutoSync && (broker != null) && broker.isInTransaction())
  +        if (useAutoSync && (broker != null) && broker.isInTransaction())
           {
               identitiesInWork.add(oid);
           }
  @@ -288,6 +287,8 @@
       private void synchronizeWithTracedObjects()
       {
           Identity oid;
  +        LoggerFactory.getDefaultLogger().info("[" + this.getClass().getName() + "] tx was
aborted," +
  +                " remove " + identitiesInWork.size() + " traced (potentially modified)
objects from cache");
           for (Iterator iterator = identitiesInWork.iterator(); iterator.hasNext();)
           {
               oid = (Identity) iterator.next();
  @@ -300,20 +301,21 @@
           synchronizeWithTracedObjects();
       }
   
  -    public void beforeClose(PBStateEvent event)
  +    public void beforeCommit(PBStateEvent event)
       {
           identitiesInWork.clear();
       }
   
  -    public void afterRollback(PBStateEvent event)
  +    public void beforeClose(PBStateEvent event)
       {
  +        identitiesInWork.clear();
       }
   
  -    public void afterCommit(PBStateEvent event)
  +    public void afterRollback(PBStateEvent event)
       {
       }
   
  -    public void beforeCommit(PBStateEvent event)
  +    public void afterCommit(PBStateEvent event)
       {
       }
   
  @@ -341,7 +343,7 @@
           {
               this.ref = new SoftReference(object);
               // if timeout is negative, lifetime of object never expire
  -            if(timeout < 0)
  +            if (timeout < 0)
               {
                   lifetime = Long.MAX_VALUE;
               }
  
  
  

---------------------------------------------------------------------
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