You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by ar...@apache.org on 2006/09/26 14:07:11 UTC
svn commit: r450011 -
/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/cache/CacheDistributor.java
Author: arminw
Date: Tue Sep 26 05:07:11 2006
New Revision: 450011
URL: http://svn.apache.org/viewvc?view=rev&rev=450011
Log:
minor changes, use final method arguments
Modified:
db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/cache/CacheDistributor.java
Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/cache/CacheDistributor.java
URL: http://svn.apache.org/viewvc/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/cache/CacheDistributor.java?view=diff&rev=450011&r1=450010&r2=450011
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/cache/CacheDistributor.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/broker/cache/CacheDistributor.java Tue Sep 26 05:07:11 2006
@@ -55,8 +55,10 @@
class CacheDistributor implements ObjectCacheInternal
{
private static Logger log = LoggerFactory.getLogger(CacheDistributor.class);
- private static final String DESCRIPTOR_BASED_CACHES = "descriptorBasedCaches";
- public static final String CACHE_EXCLUDES_STRING = "cacheExcludes";
+
+ static final String DESCRIPTOR_BASED_CACHES = "descriptorBasedCaches";
+ static final String CACHE_EXCLUDES_STRING = "cacheExcludes";
+
private static final String DELIMITER_FOR_EXCLUDE = ",";
private static final ObjectCacheInternal DUMMY_CACHE =
new ObjectCacheInternalWrapper(new ObjectCacheEmptyImpl(null, null));
@@ -96,7 +98,7 @@
}
}
- public void cache(Identity oid, Object obj)
+ public void cache(final Identity oid, final Object obj)
{
getCache(oid.getObjectsTopLevelClass()).cache(oid, obj);
}
@@ -104,17 +106,17 @@
/**
* @see ObjectCacheInternal#cacheIfNew(org.apache.ojb.broker.Identity, Object)
*/
- public boolean cacheIfNew(Identity oid, Object obj)
+ public boolean cacheIfNew(final Identity oid, final Object obj)
{
return getCache(oid.getObjectsTopLevelClass()).cacheIfNew(oid, obj);
}
- public Object lookup(Identity oid)
+ public Object lookup(final Identity oid)
{
return getCache(oid.getObjectsTopLevelClass()).lookup(oid);
}
- public void remove(Identity oid)
+ public void remove(final Identity oid)
{
getCache(oid.getObjectsTopLevelClass()).remove(oid);
}
@@ -140,12 +142,12 @@
}
}
- public void doInternalCache(Identity oid, Object obj, int type)
+ public void doInternalCache(final Identity oid, final Object obj, int type)
{
getCache(oid.getObjectsTopLevelClass()).doInternalCache(oid, obj, type);
}
- public ObjectCacheInternal getCache(Class targetClass)
+ public ObjectCacheInternal getCache(final Class targetClass)
{
/*
the priorities to find an ObjectCache for a specific object are:
@@ -158,10 +160,11 @@
first search in class-descriptor, then in jdbc-connection-descriptor
for ObjectCacheDescriptor.
*/
- ObjectCacheDescriptor ocd = searchInClassDescriptor(targetClass);
+ ObjectCacheDescriptor ocd =
+ targetClass != null ? broker.getClassDescriptor(targetClass).getObjectCacheDescriptor() : null;
if(ocd == null)
{
- ocd = searchInJdbcConnectionDescriptor();
+ ocd = broker.serviceConnectionManager().getConnectionDescriptor().getObjectCacheDescriptor();
useConnectionLevelCache = true;
}
if(ocd == null)
@@ -222,7 +225,7 @@
{
if(isExcluded(targetClass))
{
- if(log.isDebugEnabled()) log.debug("Class '" + targetClass.getName() + "' is excluded from being cached");
+ if(log.isDebugEnabled()) log.debug("Class '" + (targetClass != null ? targetClass.getName() : "null") + "' is excluded from being cached");
retval = DUMMY_CACHE;
}
else
@@ -253,7 +256,7 @@
return retval;
}
- private ObjectCacheInternal prepareAndAddCache(Object key, ObjectCacheDescriptor ocd)
+ private ObjectCacheInternal prepareAndAddCache(final Object key, final ObjectCacheDescriptor ocd)
{
ObjectCacheInternal cache;
// before the synchronize method lock this,
@@ -291,7 +294,7 @@
return cache;
}
- private ObjectCacheInternal lookupCache(Object key)
+ private ObjectCacheInternal lookupCache(final Object key)
{
return (ObjectCacheInternal) caches.get(key);
}
@@ -309,9 +312,9 @@
return result;
}
- private boolean isExcluded(Class targetClass)
+ private boolean isExcluded(final Class targetClass)
{
- if(excludedPackages != null)
+ if(excludedPackages != null && targetClass != null)
{
String name = targetClass.getName();
for(int i = 0; i < excludedPackages.size(); i++)
@@ -324,31 +327,6 @@
}
}
return false;
- }
-
- /**
- * Try to lookup {@link ObjectCacheDescriptor} in
- * {@link org.apache.ojb.broker.metadata.ClassDescriptor}.
- *
- * @param targetClass
- * @return Returns the found {@link ObjectCacheDescriptor} or <code>null</code>
- * if none was found.
- */
- protected ObjectCacheDescriptor searchInClassDescriptor(Class targetClass)
- {
- return targetClass != null ? broker.getClassDescriptor(targetClass).getObjectCacheDescriptor() : null;
- }
-
- /**
- * Lookup {@link ObjectCacheDescriptor} in
- * {@link org.apache.ojb.broker.metadata.JdbcConnectionDescriptor}.
- *
- * @return Returns the found {@link ObjectCacheDescriptor} or <code>null</code>
- * if none was found.
- */
- protected ObjectCacheDescriptor searchInJdbcConnectionDescriptor()
- {
- return broker.serviceConnectionManager().getConnectionDescriptor().getObjectCacheDescriptor();
}
public String toString()
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org