openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ppod...@apache.org
Subject svn commit: r897308 - /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheManagerImpl.java
Date Fri, 08 Jan 2010 19:40:11 GMT
Author: ppoddar
Date: Fri Jan  8 19:40:10 2010
New Revision: 897308

URL: http://svn.apache.org/viewvc?rev=897308&view=rev
Log:
reduce performance cost of isCacheable().

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheManagerImpl.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheManagerImpl.java?rev=897308&r1=897307&r2=897308&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheManagerImpl.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/datacache/DataCacheManagerImpl.java
Fri Jan  8 19:40:10 2010
@@ -160,19 +160,16 @@
      * @return TRUE or FALSE if  cache mode is configured. null otherwise.
      */
     private Boolean isCacheableByMode(ClassMetaData meta) { 
-        switch (DataCacheMode.valueOf(_conf.getDataCacheMode())) {
-          case ALL: // include everything, regardless of annotation or xml configuration
-              return true;
-          case NONE: // exclude everything, regardless of annotation of xml configuration
-              return false;
-          case ENABLE_SELECTIVE: // cache only those entities which were explicitly enabled
-              return Boolean.TRUE.equals(meta.getCacheEnabled());
-          case DISABLE_SELECTIVE: // exclude *only* the entities which are explicitly excluded

-              return !Boolean.FALSE.equals(meta.getCacheEnabled());
-          case UNSPECIFIED:
-          default: // not determinable by mode 
-              return null; 
-      }
+        String mode = _conf.getDataCacheMode();
+        if (DataCacheMode.ALL.toString().equalsIgnoreCase(mode))
+            return true;
+        if (DataCacheMode.NONE.toString().equalsIgnoreCase(mode))
+            return false;
+        if (DataCacheMode.ENABLE_SELECTIVE.toString().equalsIgnoreCase(mode))
+            return Boolean.TRUE.equals(meta.getCacheEnabled());
+        if (DataCacheMode.DISABLE_SELECTIVE.toString().equalsIgnoreCase(mode))
+            return !Boolean.FALSE.equals(meta.getCacheEnabled());
+        return null;
     }
     
     /**



Mime
View raw message