Hello,

When working on EmbedPreparedStatement.java, I noticed that a few methods synchronize on the connection object, for instance addBatch. The code typically looks like this:

synchronized (getConnectionSynchronization()) {
        // Do stuff
}

The getConnectionSynchronization-method returns a reference to the root connection. I also saw that EmbedResultSet uses this more. The rest of the JDBC methods in EmbedPreparedStatement don't synchronize on this object.

I think a single connection is not expected to be shared between multiple threads simultaneously. Maybe the necessary synchronization is done at a lower level in the system.

Would anyone care to share their thoughts/knowledge on this issue?




Thanks,
--
Kristian

Reply via email to