asmuts      02/01/16 23:03:48

  Modified:    src/java/org/apache/stratum/jcs/engine/behavior
                        ICompositeCache.java
               src/java/org/apache/stratum/jcs/engine/control Cache.java
               src/java/org/apache/stratum/jcs/engine/group GroupCache.java
  Log:
  Solved most of the group problems created from cleanup by adding an
  updateExclude method to the cache hub to allow for exclusion from non local caches.  
The group cache is more concerned about where an item came from.  It needs to be able 
to control the hub without lying to it.  I didn't want to have the group cache lie and 
say that an item was nonlocal just so it wouldn't get propagated.
  
  More honest now.  Much easier to understand and keep track of.  Will clean further 
tomorrow.
  
  Need to see if the sessions are replicaitng properly tomorrow.
  
  Revision  Changes    Path
  1.4       +5 -0      
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/engine/behavior/ICompositeCache.java
  
  Index: ICompositeCache.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/engine/behavior/ICompositeCache.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ICompositeCache.java      15 Jan 2002 21:33:34 -0000      1.3
  +++ ICompositeCache.java      17 Jan 2002 07:03:48 -0000      1.4
  @@ -34,6 +34,11 @@
       public void update( ICacheElement ce, boolean localInvocation )
           throws IOException;
   
  +    /**
  +     * Allows the exclusion of non local caches.
  +     */
  +    public void updateExclude( ICacheElement ce, boolean excludeRemote )
  +        throws IOException;
   
       /**
        *  Description of the Method
  
  
  
  1.5       +85 -20    
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/engine/control/Cache.java
  
  Index: Cache.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/engine/control/Cache.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- Cache.java        17 Jan 2002 00:19:38 -0000      1.4
  +++ Cache.java        17 Jan 2002 07:03:48 -0000      1.5
  @@ -1,5 +1,60 @@
   package org.apache.stratum.jcs.engine.control;
   
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *    notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *    notice, this list of conditions and the following disclaimer in
  + *    the documentation and/or other materials provided with the
  + *    distribution.
  + *
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
  + *
  + * 4. The names "The Jakarta Project", "Velocity", and "Apache Software
  + *    Foundation" must not be used to endorse or promote products derived
  + *    from this software without prior written permission. For written
  + *    permission, please contact [EMAIL PROTECTED]
  + *
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
  +
  +
   import java.io.IOException;
   import java.io.Serializable;
   
  @@ -101,10 +156,10 @@
       /**
        *  Constructor for the Cache object
        *
  -     *@param  cacheName  Description of the Parameter
  -     *@param  auxCaches  Description of the Parameter
  -     *@param  cattr      Description of the Parameter
  -     *@param  attr       Description of the Parameter
  +     *@param  cacheName  The name of the region
  +     *@param  auxCaches  The auxiliary caches to be used by this region
  +     *@param  cattr      The cache attribute
  +     *@param  attr       The default element attributes
        */
       public Cache( String cacheName, ICache[] auxCaches, ICompositeCacheAttributes 
cattr, Attributes attr )
       {
  @@ -187,9 +242,9 @@
       /**
        *  Description of the Method
        *
  -     *@param  key              Description of the Parameter
  -     *@param  val              Description of the Parameter
  -     *@param  attr             Description of the Parameter
  +     *@param  key              Cache key
  +     *@param  val              Value to cache
  +     *@param  attr             Element attributes
        *@exception  IOException  Description of the Exception
        */
       public void put( Serializable key, Serializable val, Attributes attr )
  @@ -224,9 +279,9 @@
       /**
        *  Description of the Method
        *
  -     *@param  key              Description of the Parameter
  -     *@param  val              Description of the Parameter
  -     *@param  attr             Description of the Parameter
  +     *@param  key              Cache key
  +     *@param  val              Value to cache
  +     *@param  attr             Element attributes
        *@exception  IOException  Description of the Exception
        */
       protected synchronized void updateCaches( Serializable key, Serializable val, 
Attributes attr )
  @@ -237,9 +292,12 @@
               p( "updateCaches(key,val,attr) > ICache.INCLUDE_REMOTE_CACHE= " + 
ICache.INCLUDE_REMOTE_CACHE + " key = " + key  );
            }
   
  -        CacheElement ce = new CacheElement( cacheName, key, val );
  -        ce.setAttributes( attr );
  -        update( ce, ICache.INCLUDE_REMOTE_CACHE );
  +//        CacheElement ce = new CacheElement( cacheName, key, val );
  +//        ce.setAttributes( attr );
  +//        updateCaches( ce, ICache.INCLUDE_REMOTE_CACHE );
  +
  +        updateCaches( key, val, attr, ICache.INCLUDE_REMOTE_CACHE );
  +
       }
   
   
  @@ -264,13 +322,13 @@
   
           CacheElement ce = new CacheElement( cacheName, key, val );
           ce.setAttributes( attr );
  -        update( ce, updateRemoteCache );
  +        updateExclude( ce, updateRemoteCache );
       }
   
   
       ///////////////////////////////////////////////////////////
       /**
  -     *  Description of the Method
  +     *  Standard update method
        *
        *@param  ce               Description of the Parameter
        *@exception  IOException  Description of the Exception
  @@ -291,10 +349,17 @@
        *  Description of the Method
        *
        *@param  ce                 Description of the Parameter
  -     *@param  updateRemoteCache  Description of the Parameter
  +     *@param  updateRemoteCache  Should the nonlocal caches be updated
        *@exception  IOException    Description of the Exception
        */
  -    public synchronized void update( ICacheElement ce, boolean updateRemoteCache )
  +    public void update( ICacheElement ce, boolean updateRemoteCache )
  +        throws IOException
  +    {
  +      updateExclude( ce, updateRemoteCache );
  +    }
  +
  +
  +    public synchronized void updateExclude( ICacheElement ce, boolean 
updateRemoteCache )
           throws IOException
       {
   
  @@ -307,12 +372,12 @@
           if ( log.logLevel >= log.DEBUG )
           {
               StringBuffer params = new StringBuffer();
  -            params.append( "Cache.update(ce,updateRemoteCache) > updateRemoteCache 
= " + updateRemoteCache + " key=" + ce.getKey() + ", val=" + ce.getVal() + ", " + 
ce.getAttributes().toString() );
  +            params.append( "Cache.updateExclude(ce,updateRemoteCache) > 
updateRemoteCache = " + updateRemoteCache + " key=" + ce.getKey() + ", val=" + 
ce.getVal() + ", " + ce.getAttributes().toString() );
               log.debug( params.toString() );
           }
           if ( debugcmd )
           {
  -            p( "update(ce,updadateRemoteCache) > update updateRemoteCache = " + 
updateRemoteCache + " key = " + ce.getKey() + ", updateRemoteCache = " + 
updateRemoteCache );
  +            p( "updateExclude(ce,updadateRemoteCache) > update updateRemoteCache = 
" + updateRemoteCache + " key = " + ce.getKey() + ", updateRemoteCache = " + 
updateRemoteCache );
   
               if ( updateRemoteCache == ICache.INCLUDE_REMOTE_CACHE )
               {
  @@ -545,7 +610,7 @@
                           {
                               if ( debugcmd )
                               {
  -                                p( "in local block, aux.getCacheType() = " + 
aux.getCacheType() );
  +                                p( "get(key,container,invocation) > in local block, 
aux.getCacheType() = " + aux.getCacheType() );
                               }
   
                               try
  
  
  
  1.6       +67 -13    
jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/engine/group/GroupCache.java
  
  Index: GroupCache.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/engine/group/GroupCache.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- GroupCache.java   17 Jan 2002 00:19:38 -0000      1.5
  +++ GroupCache.java   17 Jan 2002 07:03:48 -0000      1.6
  @@ -1,5 +1,60 @@
   package org.apache.stratum.jcs.engine.group;
   
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + * Copyright (c) 2001 The Apache Software Foundation.  All rights
  + * reserved.
  + *
  + * Redistribution and use in source and binary forms, with or without
  + * modification, are permitted provided that the following conditions
  + * are met:
  + *
  + * 1. Redistributions of source code must retain the above copyright
  + *    notice, this list of conditions and the following disclaimer.
  + *
  + * 2. Redistributions in binary form must reproduce the above copyright
  + *    notice, this list of conditions and the following disclaimer in
  + *    the documentation and/or other materials provided with the
  + *    distribution.
  + *
  + * 3. The end-user documentation included with the redistribution, if
  + *    any, must include the following acknowlegement:
  + *       "This product includes software developed by the
  + *        Apache Software Foundation (http://www.apache.org/)."
  + *    Alternately, this acknowlegement may appear in the software itself,
  + *    if and wherever such third-party acknowlegements normally appear.
  + *
  + * 4. The names "The Jakarta Project", "Velocity", and "Apache Software
  + *    Foundation" must not be used to endorse or promote products derived
  + *    from this software without prior written permission. For written
  + *    permission, please contact [EMAIL PROTECTED]
  + *
  + * 5. Products derived from this software may not be called "Apache"
  + *    nor may "Apache" appear in their names without prior written
  + *    permission of the Apache Group.
  + *
  + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  + * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
  + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  + * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  + * SUCH DAMAGE.
  + * ====================================================================
  + *
  + * This software consists of voluntary contributions made by many
  + * individuals on behalf of the Apache Software Foundation.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
  +
  +
   import java.io.IOException;
   import java.io.Serializable;
   
  @@ -254,7 +309,7 @@
       {
           if ( debug )
           {
  -            p( "in getGi" );
  +            p( "getGi(gid,container,invocation)" );
               if ( invocation == ICache.LOCAL_INVOKATION )
               {
                 p( "invocation is LOCAL" );
  @@ -270,7 +325,7 @@
               obj = systemGroupIdCache.get( gid.key, container, invocation );
               if ( debug )
               {
  -                p( "got obj in getGi " + obj );
  +                p( "getGi(gid,container,invocation) > got obj in getGi " + obj );
               }
           }
           catch ( IOException ioeg )
  @@ -456,7 +511,7 @@
               {
                   if ( debug )
                   {
  -                    p( "putting via putGAN((GroupAttrName)key, val) method" );
  +                    p( "update(ce) > putting via putGAN((GroupAttrName)key, val) 
method" );
                   }
                   putGAN( ( GroupAttrName )ce.getKey(), ce.getVal() );
               }
  @@ -466,7 +521,7 @@
           }
           if ( debug )
           {
  -            p( "update(ce) -- updating " + ce.getKey() + " via super method" );
  +            p( "update(ce) > updating " + ce.getKey() + " via super method" );
           }
   
           try
  @@ -491,7 +546,7 @@
        *@exception  IOException  Description of the Exception
        */
        // PROBLEM CACHE HAS THE SAME METHOD AND THE 2nd arg is updaDateRemote
  -    public synchronized void updateGroup( ICacheElement ce, boolean invocation )
  +    public synchronized void update( ICacheElement ce, boolean invocation )
           throws IOException
       {
   
  @@ -502,7 +557,7 @@
               {
                   if ( debug )
                   {
  -                    p( "putting via ga method" );
  +                    p( "update(ce,invocation) >putting via ga method" );
                       if ( invocation == ICache.LOCAL_INVOKATION )
                       {
                         p( "invocation is LOCAL" );
  @@ -530,7 +585,6 @@
           //}
   
   
  -
           Attributes attrE = ( Attributes ) this.attr.copy();
           try
           {
  @@ -638,7 +692,7 @@
               ce.setAttributes( attrE );
               if ( debuggan )
               {
  -                p( "updating group attribute via super" );
  +                p( "putGAN( gan,val,attr,boolean invocation) > updating group 
attribute via super" );
               }
               // SEND THE ELEMENT IF THE INVOCATION WAS LOCAL
               // decide what to do with this item
  @@ -664,7 +718,7 @@
   
               if ( debuggan )
               {
  -                p( "attrNameSet.size()  = " + attrNameSet.size() );
  +                p( "putGAN( gan,val,attr,boolean invocation) > attrNameSet.size()  
= " + attrNameSet.size() );
               }
   
               CacheElement ceID = new CacheElement( this.getCacheName(), groupId.key, 
attrNameSet );
  @@ -672,7 +726,7 @@
   
               // DO NOT SEND THE UPDATE LIST REMOTELY
               // THE ELEMENT WILL BE SENT AND THE LIST MAINTAINED REMOTELY
  -            systemGroupIdCache.update( ceID, EXCLUDE_REMOTE_CACHE );
  +            systemGroupIdCache.updateExclude( ceID, EXCLUDE_REMOTE_CACHE );
               // could use the updateGroupAttr method?
   
           }
  @@ -726,7 +780,7 @@
           }
           else
           {
  -            throw new CacheException( "group " + group + " already exists " );
  +            throw new CacheException( "createGroup(group,attr) > group " + group + 
" already exists " );
           }
           try
           {
  @@ -934,11 +988,11 @@
                           ceID.setAttributes( ce.attr );
                           if ( debug )
                           {
  -                            p( "calling systemGroupIdCache.update( ceID, 
EXCLUDE_REMOTE_CACHE )" );
  +                            p( 
"updateGroupAttrNameSet((groupAttrname)key,invocation,remove) > calling 
systemGroupIdCache.update( ceID, EXCLUDE_REMOTE_CACHE )" );
                           }
                           // ALWAYS EXCLUDE THE REMOTE CACHE
                           // TODO: should this be configurable? no
  -                        systemGroupIdCache.update( ceID, EXCLUDE_REMOTE_CACHE );
  +                        systemGroupIdCache.updateExclude( ceID, 
EXCLUDE_REMOTE_CACHE );
   
                       }
                       catch ( IOException ioe )
  
  
  

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to