You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@turbine.apache.org by as...@apache.org on 2002/02/12 16:47:22 UTC

cvs commit: jakarta-turbine-stratum/src/java/org/apache/stratum/jcs JCS.java

asmuts      02/02/12 07:47:21

  Added:       src/java/org/apache/stratum/jcs JCS.java
  Log:
  Simple class to get access to the cache.  Should make using JCS much easier.
  Most users will only need to use this one class.
  
  Revision  Changes    Path
  1.1                  jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/JCS.java
  
  Index: JCS.java
  ===================================================================
  package org.apache.stratum.jcs;
  
  import org.apache.stratum.jcs.access.GroupCacheAccess;
  import org.apache.stratum.jcs.engine.control.Cache;
  import org.apache.stratum.jcs.engine.control.CacheAttributes;
  
  import org.apache.stratum.jcs.engine.group.GroupAttrName;
  import org.apache.stratum.jcs.engine.group.GroupCacheManager;
  import org.apache.stratum.jcs.engine.group.GroupCacheManagerFactory;
  import org.apache.stratum.jcs.engine.group.GroupId;
  import org.apache.stratum.jcs.access.exception.CacheException;
  import org.apache.stratum.jcs.engine.behavior.ICompositeCacheAttributes;
  
  /**
   *  To make using JCS a bit easier.
   *
   *@author     asmuts
   *@created    February 12, 2002
   */
  public class JCS extends GroupCacheAccess
  {
  
      private static GroupCacheManager cacheMgr;
  
      ///////////////////////////////////////////
      /**
       *  Constructor for the JCS object
       *
       *@param  cacheControl  Description of the Parameter
       */
      protected JCS( Cache cacheControl )
      {
          super( cacheControl );
      }
  
  
      /////////////////////////////////////////
      /**
       *  Gets the groupAccess attribute of the GroupCacheAccess class
       *
       *@param  region              Description of the Parameter
       *@return                     The groupAccess value
       *@exception  CacheException  Description of the Exception
       */
      public static JCS getJCS( String region )
          throws CacheException
      {
          if ( cacheMgr == null )
          {
              synchronized ( GroupCacheAccess.class )
              {
                  if ( cacheMgr == null )
                  {
                      cacheMgr = GroupCacheManagerFactory.getInstance();
                  }
              }
          }
          return new JCS( ( Cache ) cacheMgr.getCache( region ) );
      }
  
  
      /////////////////////////////////////////
      /**
       *  Gets the groupAccess attribute of the GroupCacheAccess class
       *
       *@param  region              Description of the Parameter
       *@param  icca                Description of the Parameter
       *@return                     The groupAccess value
       *@exception  CacheException  Description of the Exception
       */
      public static JCS getJCS( String region, ICompositeCacheAttributes icca )
          throws CacheException
      {
          if ( cacheMgr == null )
          {
              synchronized ( GroupCacheAccess.class )
              {
                  if ( cacheMgr == null )
                  {
                      cacheMgr = GroupCacheManagerFactory.getInstance();
                  }
              }
          }
  
          return new JCS( ( Cache ) cacheMgr.getCache( region, icca ) );
      }
  
  
  
  }
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: cvs commit: jakarta-turbine-stratum/src/java/org/apache/stratum/jcs JCS.java

Posted by Aaron Smuts <aa...@verizon.net>.
Ya, but it isn't a singleton.  I was considering making the access
objects store locks.  But this would be too limiting, and to prevent
myself form doing this, I'll name it getInstance.

I'll change it tomorrow if no one has done it by then.  Nothing is using
this class, so it is an easy change.

> -----Original Message-----
> From: dlr@despot.finemaltcoding.com
[mailto:dlr@despot.finemaltcoding.com]
> On Behalf Of Daniel Rall
> Sent: Tuesday, February 12, 2002 9:30 PM
> To: Turbine Developers List
> Cc: jakarta-turbine-stratum-cvs@apache.org
> Subject: Re: cvs commit: jakarta-turbine-
> stratum/src/java/org/apache/stratum/jcs JCS.java
> 
> Very nice!  Could we use the method name getInstance() instead of
> getJCS()?  It's more in line with the conventions used in the rest of
> the Turbine packages.
> 
> Dan
> 
> 
> asmuts@apache.org writes:
> 
> > asmuts      02/02/12 07:47:21
> >
> >   Added:       src/java/org/apache/stratum/jcs JCS.java
> >   Log:
> >   Simple class to get access to the cache.  Should make using JCS
much
> easier.
> >   Most users will only need to use this one class.
> >
> >   Revision  Changes    Path
> >   1.1                  jakarta-turbine-
> stratum/src/java/org/apache/stratum/jcs/JCS.java
> >
> >   Index: JCS.java
> >
===================================================================
> >   package org.apache.stratum.jcs;
> >
> >   import org.apache.stratum.jcs.access.GroupCacheAccess;
> >   import org.apache.stratum.jcs.engine.control.Cache;
> >   import org.apache.stratum.jcs.engine.control.CacheAttributes;
> >
> >   import org.apache.stratum.jcs.engine.group.GroupAttrName;
> >   import org.apache.stratum.jcs.engine.group.GroupCacheManager;
> >   import
org.apache.stratum.jcs.engine.group.GroupCacheManagerFactory;
> >   import org.apache.stratum.jcs.engine.group.GroupId;
> >   import org.apache.stratum.jcs.access.exception.CacheException;
> >   import
> org.apache.stratum.jcs.engine.behavior.ICompositeCacheAttributes;
> >
> >   /**
> >    *  To make using JCS a bit easier.
> >    *
> >    *@author     asmuts
> >    *@created    February 12, 2002
> >    */
> >   public class JCS extends GroupCacheAccess
> >   {
> >
> >       private static GroupCacheManager cacheMgr;
> >
> >       ///////////////////////////////////////////
> >       /**
> >        *  Constructor for the JCS object
> >        *
> >        *@param  cacheControl  Description of the Parameter
> >        */
> >       protected JCS( Cache cacheControl )
> >       {
> >           super( cacheControl );
> >       }
> >
> >
> >       /////////////////////////////////////////
> >       /**
> >        *  Gets the groupAccess attribute of the GroupCacheAccess
class
> >        *
> >        *@param  region              Description of the Parameter
> >        *@return                     The groupAccess value
> >        *@exception  CacheException  Description of the Exception
> >        */
> >       public static JCS getJCS( String region )
> >           throws CacheException
> >       {
> >           if ( cacheMgr == null )
> >           {
> >               synchronized ( GroupCacheAccess.class )
> >               {
> >                   if ( cacheMgr == null )
> >                   {
> >                       cacheMgr =
GroupCacheManagerFactory.getInstance();
> >                   }
> >               }
> >           }
> >           return new JCS( ( Cache ) cacheMgr.getCache( region ) );
> >       }
> >
> >
> >       /////////////////////////////////////////
> >       /**
> >        *  Gets the groupAccess attribute of the GroupCacheAccess
class
> >        *
> >        *@param  region              Description of the Parameter
> >        *@param  icca                Description of the Parameter
> >        *@return                     The groupAccess value
> >        *@exception  CacheException  Description of the Exception
> >        */
> >       public static JCS getJCS( String region,
ICompositeCacheAttributes
> icca )
> >           throws CacheException
> >       {
> >           if ( cacheMgr == null )
> >           {
> >               synchronized ( GroupCacheAccess.class )
> >               {
> >                   if ( cacheMgr == null )
> >                   {
> >                       cacheMgr =
GroupCacheManagerFactory.getInstance();
> >                   }
> >               }
> >           }
> >
> >           return new JCS( ( Cache ) cacheMgr.getCache( region, icca
) );
> >       }
> >
> >
> >
> >   }
> >
> >
> >
> >
> > --
> > To unsubscribe, e-mail:   <mailto:turbine-dev-
> unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail: <mailto:turbine-dev-
> help@jakarta.apache.org>
> 
> --
> To unsubscribe, e-mail:   <mailto:turbine-dev-
> unsubscribe@jakarta.apache.org>
> For additional commands, e-mail: <mailto:turbine-dev-
> help@jakarta.apache.org>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: cvs commit: jakarta-turbine-stratum/src/java/org/apache/stratum/jcs JCS.java

Posted by Daniel Rall <dl...@finemaltcoding.com>.
Very nice!  Could we use the method name getInstance() instead of
getJCS()?  It's more in line with the conventions used in the rest of
the Turbine packages.

Dan


asmuts@apache.org writes:

> asmuts      02/02/12 07:47:21
>
>   Added:       src/java/org/apache/stratum/jcs JCS.java
>   Log:
>   Simple class to get access to the cache.  Should make using JCS much easier.
>   Most users will only need to use this one class.
>   
>   Revision  Changes    Path
>   1.1                  jakarta-turbine-stratum/src/java/org/apache/stratum/jcs/JCS.java
>   
>   Index: JCS.java
>   ===================================================================
>   package org.apache.stratum.jcs;
>   
>   import org.apache.stratum.jcs.access.GroupCacheAccess;
>   import org.apache.stratum.jcs.engine.control.Cache;
>   import org.apache.stratum.jcs.engine.control.CacheAttributes;
>   
>   import org.apache.stratum.jcs.engine.group.GroupAttrName;
>   import org.apache.stratum.jcs.engine.group.GroupCacheManager;
>   import org.apache.stratum.jcs.engine.group.GroupCacheManagerFactory;
>   import org.apache.stratum.jcs.engine.group.GroupId;
>   import org.apache.stratum.jcs.access.exception.CacheException;
>   import org.apache.stratum.jcs.engine.behavior.ICompositeCacheAttributes;
>   
>   /**
>    *  To make using JCS a bit easier.
>    *
>    *@author     asmuts
>    *@created    February 12, 2002
>    */
>   public class JCS extends GroupCacheAccess
>   {
>   
>       private static GroupCacheManager cacheMgr;
>   
>       ///////////////////////////////////////////
>       /**
>        *  Constructor for the JCS object
>        *
>        *@param  cacheControl  Description of the Parameter
>        */
>       protected JCS( Cache cacheControl )
>       {
>           super( cacheControl );
>       }
>   
>   
>       /////////////////////////////////////////
>       /**
>        *  Gets the groupAccess attribute of the GroupCacheAccess class
>        *
>        *@param  region              Description of the Parameter
>        *@return                     The groupAccess value
>        *@exception  CacheException  Description of the Exception
>        */
>       public static JCS getJCS( String region )
>           throws CacheException
>       {
>           if ( cacheMgr == null )
>           {
>               synchronized ( GroupCacheAccess.class )
>               {
>                   if ( cacheMgr == null )
>                   {
>                       cacheMgr = GroupCacheManagerFactory.getInstance();
>                   }
>               }
>           }
>           return new JCS( ( Cache ) cacheMgr.getCache( region ) );
>       }
>   
>   
>       /////////////////////////////////////////
>       /**
>        *  Gets the groupAccess attribute of the GroupCacheAccess class
>        *
>        *@param  region              Description of the Parameter
>        *@param  icca                Description of the Parameter
>        *@return                     The groupAccess value
>        *@exception  CacheException  Description of the Exception
>        */
>       public static JCS getJCS( String region, ICompositeCacheAttributes icca )
>           throws CacheException
>       {
>           if ( cacheMgr == null )
>           {
>               synchronized ( GroupCacheAccess.class )
>               {
>                   if ( cacheMgr == null )
>                   {
>                       cacheMgr = GroupCacheManagerFactory.getInstance();
>                   }
>               }
>           }
>   
>           return new JCS( ( Cache ) cacheMgr.getCache( region, icca ) );
>       }
>   
>   
>   
>   }
>   
>   
>   
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>