You are viewing a plain text version of this content. The canonical link for it is here.
Posted to slide-dev@jakarta.apache.org by re...@apache.org on 2001/08/31 19:50:36 UTC

cvs commit: jakarta-slide/src/share/org/apache/slide/store StandardStore.java

remm        01/08/31 10:50:36

  Modified:    src/share/org/apache/slide/store StandardStore.java
  Log:
  - Flush caches when delisting with a failure. Unfortunately, Slide has at the
    moment no way of knowing which objects are affected by a rollback, so this
    is the only way to clean the cache.
  
  Revision  Changes    Path
  1.16      +35 -4     jakarta-slide/src/share/org/apache/slide/store/StandardStore.java
  
  Index: StandardStore.java
  ===================================================================
  RCS file: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/StandardStore.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- StandardStore.java	2001/07/25 17:56:37	1.15
  +++ StandardStore.java	2001/08/31 17:50:36	1.16
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/StandardStore.java,v 1.15 2001/07/25 17:56:37 remm Exp $
  - * $Revision: 1.15 $
  - * $Date: 2001/07/25 17:56:37 $
  + * $Header: /home/cvs/jakarta-slide/src/share/org/apache/slide/store/StandardStore.java,v 1.16 2001/08/31 17:50:36 remm Exp $
  + * $Revision: 1.16 $
  + * $Date: 2001/08/31 17:50:36 $
    *
    * ====================================================================
    *
  @@ -68,6 +68,8 @@
   import java.util.Vector;
   import java.io.FileWriter;
   import java.io.IOException;
  +import javax.transaction.xa.XAException;
  +import javax.transaction.xa.Xid;
   import org.apache.slide.common.*;
   import org.apache.slide.structure.*;
   import org.apache.slide.security.*;
  @@ -80,7 +82,7 @@
    * Abstract implementation of a store. Handles all caching operations.
    *
    * @author <a href="mailto:remm@apache.org">Remy Maucherat</a>
  - * @version $Revision: 1.15 $
  + * @version $Revision: 1.16 $
    */
   public class StandardStore extends AbstractStore {
       
  @@ -690,4 +692,33 @@
       }
   
   
  +    // ------------------------------------------------------ Protected Methods
  +    
  +    
  +    /**
  +     * Delist (suspend) the resource manager in the current transaction.
  +     */
  +    protected void delist(Service service, boolean success)
  +        throws ServiceAccessException {
  +        if (!success) {
  +            // If there's a failure which will cause the transaction to be 
  +            // rollbacked, flush the caches
  +            resetCaches();
  +        }
  +        super.delist(service, success);
  +    }
  +    
  +    
  +    /**
  +     * Reset the caches.
  +     */
  +    protected void resetCaches() {
  +        objectsCache.clear();
  +        permissionsCache.clear();
  +        locksCache.clear();
  +        descriptorsCache.clear();
  +        descriptorCache.clear();
  +    }
  +    
  +    
   }