There really isn't a "problem". It was more of a question concerning performance.
Currently, I am using multiple PB instances to access different databases.
I was only asking if it would be more efficient if instead of accessing multiple brokers in one thread, if I could distribute the work between multiple threads and have the application run faster or use less memory.
You stated "Use the PB to do the work and immediately close the PB after use."
Why would you need to "... immediately close the PB after use."?
My application might have to go back to that PB multiple times before it stops running...
Also - why do you "strongly advise against using internal non-api classes"? I don't know what you mean. You mean don't extend any OJB classes? --bobby
Armin Waibel wrote:
Hi Robert,
[EMAIL PROTECTED] wrote:
My OJB application uses multiple PersistenceBrokers to access different databases. The only way I could do it was by calling PersistenceBrokerThreadMapping.setCurrentPersistenceBroker(<broker>); because the app was running in its one thread.
Sorry, think I don't understand the problem. You can lookup several PB instances each access a different DB.
http://db.apache.org/ojb/docu/faq.html#lookupPB http://db.apache.org/ojb/docu/faq.html#multipleDB
I was just wondering if you spawned multiple threads, each with its own broker, and each broker accessing different databases .... could you get your app to get data from the brokers in each thread?
yep, no problem (or if you don't think so, please describe the problem more detailed - code snip). Lookup an PB instance in each thread using a PBKey to specify the DB (using jcdAlias name defined in jdbc-connection-descriptor). Use the PB to do the work and immediately close the PB after use.
And would it be
faster or more efficient than what I'm doing now? (it works fine, but I'm
worried about dealing with memory and run time issues)
Not sure what you are doing (sharing one PB instance in your app?), but I strongly advise against using internal non-api classes.
regards, Armin
--Bobby
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
-- ---------------------------- Bobby Lawrence MIS Application Developer
Jefferson Lab (www.jlab.org)
Email: [EMAIL PROTECTED] Office: (757) 269-5818 Pager: (757) 584-5818 ----------------------------
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
