Matthew, when you say PBs aren't threadsafe, do you mean several threads (like a web servlet environment) that each have their own call to PersistenceBrokerFactory.defaultPersistenceBroker(), and each does a transaction in it's own thread, is not safe?
The reason I ask is I have been having strange problems (running 0.9.7) where connections that I am done with (on a simple read) are in the middle of transactions when I call close on them, when I never even started a transaction. And sometimes when I get a PB connection and start a transaction, it gives me a TransactionInProgress exception. It's almost as if the PersistenceBrokerFactory is giving out a connection more than once, or it's exactly what you are saying in that is not safe. It almost seems like the internal flag for 'inLocalTransaction' the connection manager keeps is getting fouled up after a while. However I can't seem to recreate it quickly, it takes 24+ hours to start happening. I thought maybe my problem could be related to this one :) If this is a bad approach to using the PB api, what is the correct way? Ryan -----Original Message----- From: Matthew Baird [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 07, 2003 7:06 PM To: OJB Users List Subject: RE: ConnectionManager threading problem persistencebrokers are NOT threadsafe. SOunds like you are using them as though they are. -----Original Message----- From: Norman C. Jarvis [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 07, 2003 4:11 PM To: OJB Users List Subject: ConnectionManager threading problem I have been getting a NullPointerException in StatementsForClassImpl.java in the prepareStatement method. The reason for the exception is that the Connection parameter is null when the method is invoked. I followed the stack trace to the ConnectionManager class and found that multiple threads were accessing the same ConnectionManager object. I also found that as one thread was executing the getConnection method another thread using the same ConnectionManager object was invoking the releaseConnection method. This caused the getConnection method to pass the null checks successfully and then get preempted and the other thread would set the con object to null in the releaseConnection method and then the first thread would continue and return the nulled con object thus causing the Connection parameter of the prepareStatement method in the StatementsForClassImpl class to be null thereby throwing a NullPointerException. I am wondering if multiple threads should be using the same ConnectionManager object? If not, then I am doing something wrong in how I am using PersistenceBroker's. If so, then should not these methods be synchronized? -- Norman Jarvis [EMAIL PROTECTED] -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
