db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Martin Kalén <mka...@apache.org>
Subject Re: RFC: OJB1.0 - CollectionProxies and per-thread metadata changes
Date Wed, 23 Feb 2005 21:58:06 GMT
Armin Waibel wrote:
> Hi Martin,
>  > The problem with OJB 1.0 is that this configuration (i.e. per-thread
>  > metadata changes and any CollectionProxy instance) is undefined. The
>  > proxy is no longer a true proxy, since loading the data might or might
>  > not succeed depending on in which thread it is loaded.
> Agree with you.
>  > I have created a local fix on the 1.0 branch that will:
>  > a) allow usage of per-thread metadata changes and profile keys with
>  > dynamic proxies (by storing a reference to the key used while creating
>  > the proxy, in the same fashion a reference to a broker key is stored)
>  >
>  > b) throwing an exception if per-thread metadata changes are activated,
>  > but no profile loaded while creating the CollectionProxy.
>  >
> Which classes will be affected? Do need any api changes?

I have modified:
org.apache.ojb.broker.metadata.MetadataManager [1]
org.apache.ojb.broker.core.proxy.CollectionProxyDefaultImpl [2]
org.apache.ojb.broker.metadata.MetadataMultithreadedTest [3]

* Introduced local variable "currentProfileKey", set when loading 
profile by key.
* Introduced new API method "getCurrentProfileKey" to read currentProfileKey

* Introduced local variable "_perThreadDescriptorsEnabled", set in 
constructor if per-thread metadata changes are active.
* Introduced local variable "_profileKey" with protected getter/setter, 
used to load profile when lazy-loading with per-thread metadata profiles.
* Added protected method "loadProfile" which will perform the
forementioned profile-loading.
* Added intercept calls to loadProfile before any data is loaded.

* Added new test method "testProxiedLoading" to provoke the bug fixed by 
changes #1 and #2.

Since the changes are transparent if one does not use per-thread changes 
and the only API-change is 1 added method, I will commit this on the 1.0 
release-branch. It makes using profiles+proxies a bit slower (profile 
loading overhead when materialising proxy), but prevents previously 
undefined behaviour with the occasional 

Please review and let me know if you have any issues with the new code. 
I will update release-notes.txt accordingly.


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

View raw message