The JDBC spec doesn't require Connection to be thread-safe. But H2's Connection (http://www.h2database.com/javadoc/org/h2/jdbc/ JdbcConnection.html) is thread-safe. So yes, it's a kind of weird: as long as you use H2, you'll be fine, but since you're doing it "wrong", you'll lose interchangeability with other databases.
Best Regards, Joonas On 21 huhti, 05:41, Chris Schanck <[email protected]> wrote: > The product I work on happily makes use of 100+ threads over 1 connection in > certain situations where multiple threads are evaluating different data > points which need to have the same transaction visibility. So far, H2 is > decent at this. > > Chris > > On Mon, Apr 19, 2010 at 8:23 PM, James Gregurich <[email protected]>wrote: > > > > > > > consider... > > > public synchronized void close() throws SQLException { > > > To me, it stands to reason that in a process, one should logically be using > > a connection-per-thread pattern rather than sharing a connection over > > several threads. As a result, my gut here says leave the synchronized out > > here....there is no need for a connection to have access to it serialized. > > Why have the extra mutex use here when in general, proper use, it isn't > > needed. > > > Is there some legitimate reason that I'm not aware of why one would must > > have a single connection shared over multiple threads? > > > -James > > > -- > > You received this message because you are subscribed to the Google Groups > > "H2 Database" group. > > To post to this group, send email to [email protected]. > > To unsubscribe from this group, send email to > > [email protected]<h2-database%2bunsubscr...@googlegr > > oups.com> > > . > > For more options, visit this group at > >http://groups.google.com/group/h2-database?hl=en. > > -- > C. Schanck > > -- > You received this message because you are subscribed to the Google Groups "H2 > Database" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/h2-database?hl=en. -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.
