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]>

Reply via email to