Subject | Re: [Firebird-Java] DataSource question |
---|---|
Author | David Jencks |
Post date | 2004-09-03T16:34:34Z |
On Sep 3, 2004, at 9:12 AM, Juan Pedro López Sáez wrote:
thanks
david jencks
> Hello All,This is the correct approach.
>
> This is a very simple question.
>
> I'm using Jaybird 1.0.1, Tomcat and DBCP to implement a DataSource for
> my database connections.
>
> Till now I have a servlet Filter where I first initialize the
> DataSource
> (in the Filter.init() method). For every request I get a database
> Connection calling DataSource.getConnection() inside a synchonized
> block
> (in the Filter.doFilter() method). When the request finishes, the
> Filter
> closes the connection. So, every database connection is kept opened
> just
> while the request is in process.
>
> Now I want some requests to behave in a different fashion. I want them
> to spawn a thread to make some long processing tasks in background.
> The
> initial request will instead response to the client as soon as
> possible.
> The matter is that I need to provide the new thread a database
> connection which remains opened till the job is done.
>
> My first solutions has been to pass the DataSource reference to the
> new
> thread so that it can get its own database connection.
>yes
> Question: is DataSource.getConnection() thread-safe?
> Is it java databaseno
> driver dependent?
> Are there any related to constraints?Not that I know of.
>yes
> I guess if it is really thread-safe I could probably remove the
> synchonized block in my filter.
thanks
david jencks
>
> Thank you very much.
>
> Juan Pedro Lopez
>
>
>
>
>
> Yahoo! Groups Sponsor
>
> ADVERTISEMENT
> <81804_0704_b_300250a.gif>
> <l.gif>
>
> Yahoo! Groups Links
>
> • To visit your group on the web, go to:
> http://groups.yahoo.com/group/Firebird-Java/
>
> • To unsubscribe from this group, send an email to:
> Firebird-Java-unsubscribe@yahoogroups.com
>
> • Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service.
>
>