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 Tino Schöllhorn <t....@tiscali.de> on 2004/02/12 18:40:01 UTC
Cache Bug with multiple PersistenceBrokers?
Hi,
I have a very, very strange phenomenom: I have one web-application which
handles several clients. Each client uses its own database, but the
database schema is always the same.
Our web-application handles requests for all clients, so I have to
switch the PersistenceBroker as soon as I notice that another client
should be handled.
This generally works fine when testing one client, but when testing
other clients simultanously data of client A appears in the results of
client B and vice versa. The most funny (?) thing is that the visible
data switches from client A to client B after a few clicks.
Is it possible that the cache ojb-uses doesn't respect the different
PersistenceBrokers? That would explain the described behaviour.
How could I turn off the cache, so I can verify this ?
Do you have other ideas which I might try ?
I am using ojb1.0rc5
With regards Tino
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Cache Bug with multiple PersistenceBrokers?
Posted by Armin Waibel <ar...@apache.org>.
Hi Tino,
Tino Schöllhorn wrote:
> Hello Armin,
>
> I just found another thread which has the same topic. There you
> mentioned that it is possible to define different threads for each
> connection-descriptor. So if I declared something like
>
> <jdbc-connection-descriptor ...>
> ...
> <object-cache
> class="org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl">
> </object-cache>
> ...
> </jdbc-connection-descriptor>
>
> then everything would behave as one might expect? would'nt it?
yep! But ObjectCachePerBrokerImpl isn't very smart. On each
PB.close()/commitTransaction()/abortTransaction() the cache will be
cleared. So an specific ObjectCache implementation may helpful.
regards,
Armin
> Tino
>
>
> Armin Waibel wrote:
>
>> Hi Tino,
>>
>> Tino Schöllhorn wrote:
>>
>>> Hi,
>>>
>>> I have a very, very strange phenomenom: I have one web-application
>>> which handles several clients. Each client uses its own database, but
>>> the database schema is always the same.
>>>
>>> Our web-application handles requests for all clients, so I have to
>>> switch the PersistenceBroker as soon as I notice that another client
>>> should be handled.
>>>
>>> This generally works fine when testing one client, but when testing
>>> other clients simultanously data of client A appears in the results
>>> of client B and vice versa. The most funny (?) thing is that the
>>> visible data switches from client A to client B after a few clicks.
>>>
>>> Is it possible that the cache ojb-uses doesn't respect the different
>>> PersistenceBrokers? That would explain the described behaviour.
>>>
>>
>> If you use the default cache (ObjectCacheDefaultImpl) implementation
>> you are right. This implementation is shared and only based on
>> persistence capable object Identity instances. All your databases use
>> the same schema, thus same Identity object can arise.
>> See
>> http://db.apache.org/ojb/objectcache.html#Shipped cache implementations
>>
>>> How could I turn off the cache, so I can verify this ?
>>>
>>
>> You can use ObjectCachePerBrokerImpl instead.
>>
>>> Do you have other ideas which I might try ?
>>>
>>
>> You can write a shared cache based on the used PBKey.
>>
>> regards,
>> Armin
>>
>>> I am using ojb1.0rc5
>>>
>>> With regards Tino
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org
Re: Cache Bug with multiple PersistenceBrokers?
Posted by Tino Schöllhorn <t....@tiscali.de>.
Hello Armin,
I just found another thread which has the same topic. There you
mentioned that it is possible to define different threads for each
connection-descriptor. So if I declared something like
<jdbc-connection-descriptor ...>
...
<object-cache
class="org.apache.ojb.broker.cache.ObjectCachePerBrokerImpl">
</object-cache>
...
</jdbc-connection-descriptor>
then everything would behave as one might expect? would'nt it?
Tino
Armin Waibel wrote:
> Hi Tino,
>
> Tino Schöllhorn wrote:
>
>> Hi,
>>
>> I have a very, very strange phenomenom: I have one web-application
>> which handles several clients. Each client uses its own database, but
>> the database schema is always the same.
>>
>> Our web-application handles requests for all clients, so I have to
>> switch the PersistenceBroker as soon as I notice that another client
>> should be handled.
>>
>> This generally works fine when testing one client, but when testing
>> other clients simultanously data of client A appears in the results of
>> client B and vice versa. The most funny (?) thing is that the visible
>> data switches from client A to client B after a few clicks.
>>
>> Is it possible that the cache ojb-uses doesn't respect the different
>> PersistenceBrokers? That would explain the described behaviour.
>>
>
> If you use the default cache (ObjectCacheDefaultImpl) implementation you
> are right. This implementation is shared and only based on persistence
> capable object Identity instances. All your databases use the same
> schema, thus same Identity object can arise.
> See
> http://db.apache.org/ojb/objectcache.html#Shipped cache implementations
>
>> How could I turn off the cache, so I can verify this ?
>>
>
> You can use ObjectCachePerBrokerImpl instead.
>
>> Do you have other ideas which I might try ?
>>
>
> You can write a shared cache based on the used PBKey.
>
> regards,
> Armin
>
>> I am using ojb1.0rc5
>>
>> With regards Tino
>>
>>
>>
>> ---------------------------------------------------------------------
>> 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
Re: Cache Bug with multiple PersistenceBrokers?
Posted by Armin Waibel <ar...@apache.org>.
Hi Tino,
Tino Schöllhorn wrote:
> Hi,
>
> I have a very, very strange phenomenom: I have one web-application which
> handles several clients. Each client uses its own database, but the
> database schema is always the same.
>
> Our web-application handles requests for all clients, so I have to
> switch the PersistenceBroker as soon as I notice that another client
> should be handled.
>
> This generally works fine when testing one client, but when testing
> other clients simultanously data of client A appears in the results of
> client B and vice versa. The most funny (?) thing is that the visible
> data switches from client A to client B after a few clicks.
>
> Is it possible that the cache ojb-uses doesn't respect the different
> PersistenceBrokers? That would explain the described behaviour.
>
If you use the default cache (ObjectCacheDefaultImpl) implementation you
are right. This implementation is shared and only based on persistence
capable object Identity instances. All your databases use the same
schema, thus same Identity object can arise.
See
http://db.apache.org/ojb/objectcache.html#Shipped cache implementations
> How could I turn off the cache, so I can verify this ?
>
You can use ObjectCachePerBrokerImpl instead.
> Do you have other ideas which I might try ?
>
You can write a shared cache based on the used PBKey.
regards,
Armin
> I am using ojb1.0rc5
>
> With regards Tino
>
>
>
> ---------------------------------------------------------------------
> 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