Hi,
I think you can exactly do that. Just use a thread variable (see
ThreadLocal) and store a PB in that. We are doing exactly that and it
works great.
You just have to close the PBs when the work of your thread is done, of
course.
Tino
Ernst Temp wrote:
Hello,
I am developing an application that contains of two programs
One that needs persistency. Here I use PersistenceBroker very
successfully
The second one does not need persistency at all, and performance is
quite important. The program also relies heavily on cached data, but
there is no need to synchronize the program with the database or with
other threads. One can assume that the database does not change at all
during the runtime of the program.
And here comes my problem - I also used PersistenceBroker in this
program in order to reuse code. Now, I found out through profiling, that
the program spends about 40 % of its time in PersistenceBroker, mostly
defaultBroker() and close().
I am accessing the DB heavily (reads only), and for every read I open a
PB, read the needed data (that should come ot of the cache most of the
time), then close the PB. This is quite expensive. As a solution, I
could use only one PB for each thread open it at the start, leave it
open, and then I would not need any opening and closing at all (except
the first one for each thread).
My questions are
- can I do that and if so, is it wise?
- are there other - better solutions? May be done through
configuration of the properties files?
Thank you very much for your help and kind regards,
Ernst
NB - I am using OJB v 1.0.0.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]