You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by CLARAMONTE Jean-Baptiste <jb...@aston.fr> on 2005/02/28 16:12:56 UTC

Different locations for defining the cache

Hello everyone,
		
I don't understand the behavior of OJB when you define a cache on a per
jdbc-connection-descriptor.
In the CacheDistributor.java class at the following method we've got this
snippet :

public ObjectCache getCache(Identity oid, Object obj, int callingMethod) {
 ...
	// use a jdbc-connection-descriptor level cache
	else
	{
	    String jcdAlias =
broker.serviceConnectionManager().getConnectionDescriptor().getJcdAlias();
	    synchronized (caches)
	    {
	        retval = lookupCache(jcdAlias);
	
	        if (retval == null && callingMethod ==
AbstractMetaCache.METHOD_CACHE)
	        {
	            retval = prepareAndAddCache(broker, ocd, jcdAlias);
	        }
	    }
	}
 ...
}

So we are only instanciating a new cache when "callingMethod ==
AbstractMetaCache.METHOD_CACHE".
I don't understand why we need to make a limitation like this one ?

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: Different locations for defining the cache

Posted by Armin Waibel <ar...@apache.org>.
Hi,

 > So we are only instanciating a new cache when "callingMethod ==
 > AbstractMetaCache.METHOD_CACHE".
 > I don't understand why we need to make a limitation like this one ?

this part of CacheDistributor.java was changed in CVS (branch 
OJB_1_0_RELEASE). Now always a new cache was created. Sorry can't post a 
link to current the version, because cvs.apache.org is down.

regards,
Armin


CLARAMONTE Jean-Baptiste wrote:
> Hello everyone,
> 		
> I don't understand the behavior of OJB when you define a cache on a per
> jdbc-connection-descriptor.
> In the CacheDistributor.java class at the following method we've got this
> snippet :
> 
> public ObjectCache getCache(Identity oid, Object obj, int callingMethod) {
>  ...
> 	// use a jdbc-connection-descriptor level cache
> 	else
> 	{
> 	    String jcdAlias =
> broker.serviceConnectionManager().getConnectionDescriptor().getJcdAlias();
> 	    synchronized (caches)
> 	    {
> 	        retval = lookupCache(jcdAlias);
> 	
> 	        if (retval == null && callingMethod ==
> AbstractMetaCache.METHOD_CACHE)
> 	        {
> 	            retval = prepareAndAddCache(broker, ocd, jcdAlias);
> 	        }
> 	    }
> 	}
>  ...
> }
> 
> So we are only instanciating a new cache when "callingMethod ==
> AbstractMetaCache.METHOD_CACHE".
> I don't understand why we need to make a limitation like this one ?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org