portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject cvs commit: jakarta-jetspeed/src/java/org/apache/jetspeed/cache/disk JetspeedDiskCache.java
Date Wed, 01 May 2002 04:38:24 GMT
taylor      02/04/30 21:38:24

  Modified:    src/java/org/apache/jetspeed/cache/disk
                        JetspeedDiskCache.java
  Log:
  patch from Todd Kuebler
  
  Revision  Changes    Path
  1.46      +18 -17    jakarta-jetspeed/src/java/org/apache/jetspeed/cache/disk/JetspeedDiskCache.java
  
  Index: JetspeedDiskCache.java
  ===================================================================
  RCS file: /home/cvs/jakarta-jetspeed/src/java/org/apache/jetspeed/cache/disk/JetspeedDiskCache.java,v
  retrieving revision 1.45
  retrieving revision 1.46
  diff -u -r1.45 -r1.46
  --- JetspeedDiskCache.java	25 Apr 2002 18:40:22 -0000	1.45
  +++ JetspeedDiskCache.java	1 May 2002 04:38:24 -0000	1.46
  @@ -82,7 +82,7 @@
   @see org.apache.jetspeed.daemon.impl.DiskCacheDaemon
   @author <A HREF="mailto:burton@apache.org">Kevin A. Burton</A>
   @author <a href="mailto:sgala@hisitech.com">Santiago Gala</a>
  -@version $Id: JetspeedDiskCache.java,v 1.45 2002/04/25 18:40:22 sgala Exp $
  +@version $Id: JetspeedDiskCache.java,v 1.46 2002/05/01 04:38:24 taylor Exp $
   */
   public class JetspeedDiskCache implements DiskCache {
   
  @@ -113,6 +113,21 @@
       */
       private JetspeedDiskCache(String directory) {
           this.directory = directory;
  +
  +	if ( DEFAULT_CACHE_DIRECTORY.equals("use-servlet-temp") ) {
  +            String tempdir = new String("WEB-INF/cache");
  +            try {
  +                ServletContext sc = TurbineServlet.getServletContext();
  +                tempdir = sc.getAttribute("javax.servlet.context.tempdir").toString() +
"/jetspeed/cache";
  +                Log.debug("DISK CACHE: will create cache in servlet temp directory " +
tempdir);
  +            } catch (Exception e) {
  +                Log.error("DISK CACHE: problems creating cache in servlet temp directory
"
  +                           + " falling back to WEB-INF/cache : " + e);
  +            }
  +	    this.directory = tempdir;    
  +	} else {
  +                Log.debug("DISK CACHE: will use cache in user configured directory " +
directory);
  +	}
       }
       
   
  @@ -460,22 +475,7 @@
       */
       public static JetspeedDiskCache getInstance() {
   
  -	if ( DEFAULT_CACHE_DIRECTORY == null) {
  -            String tempdir = new String("WEB-INF/cache");
  -            try {
  -                ServletContext sc = TurbineServlet.getServletContext();
  -                tempdir = sc.getAttribute("javax.servlet.context.tempdir").toString() +
"/jetspeed/cache";
  -                Log.info("DISK CACHE: will create cache in servlet temp directory " + tempdir);
  -            } catch (Exception e) {
  -                Log.info("DISK CACHE: problems creating cache in servlet temp directory
"
  -                           + " falling back to WEB-INF/cache : " + e);
  -            }
  -            return JetspeedDiskCache.getInstance( tempdir );
  -	} else {
  -            Log.info("DISK CACHE: will create cache in user configured " + DEFAULT_CACHE_DIRECTORY);
  -            // should test for writability here and fallback to servlet tmp directory on
failure
  -            return JetspeedDiskCache.getInstance( DEFAULT_CACHE_DIRECTORY ); 
  -        }
  +        return JetspeedDiskCache.getInstance( DEFAULT_CACHE_DIRECTORY );
       }
   
       /**
  @@ -486,6 +486,7 @@
       public static JetspeedDiskCache getInstance( String directory ) {
   
           synchronized(JetspeedDiskCache.instances) {
  +		
               JetspeedDiskCache cache = (JetspeedDiskCache)JetspeedDiskCache.instances.get(directory);
               
               if (cache == null) {
  
  
  

--
To unsubscribe, e-mail:   <mailto:jetspeed-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:jetspeed-dev-help@jakarta.apache.org>


Mime
View raw message