From: | Craig Ringer <ringerc(at)ringerc(dot)id(dot)au> |
---|---|
To: | David Fetter <david(at)fetter(dot)org> |
Cc: | Sylvain Mougenot <smougenot(at)sqli(dot)com>, pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: [SQL] JDBC Statement.setQueryTimeout : is there plan to implement this? |
Date: | 2011-12-15 04:45:57 |
Message-ID: | 4EE97B85.50909@ringerc.id.au |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc pgsql-sql |
> I've popped a question up here:
>
>
> http://stackoverflow.com/questions/8514725/obtaining-a-java-util-timer-or-equivalent-in-a-javaee-friendly-way-that-works-on
>
> to see if I can get some broader input on the issue of portable timers.
... and boy am I glad I did, thanks to Bauke Scholtz (BalusC) on SO.
It looks like we can probably use a ScheduledThreadPoolExecutor safely
from within a Java EE container or servlet container, so long as:
- We never let EE application code that requires EE services - like
servlet code, EJBs, etc - run on its thread(s); and
- We use a ServiceLoader in /META-INF/services to destroy it when the
JDBC driver is unloaded, the war
the JDBC driver is bundled in is undeployed or the app server is stopped;
That should provide the JDBC driver with a suitable timer mechanism.
Perhaps more excitingly, a generic ThreadPoolExecutor can be safely used
within an EE container the same way, potentially allowing the JDBC
driver to use threads for blocking I/O. That'd finally permit a version
of PgConnection.getNotifications() that can be safely invoked without
blocking when SSL is in use!
A driver thread pool could also help permanently fix those occasional
deadlocks that happen due to buffer management issues in the JDBC driver.
I'll try to find time to do some testing and see if I can make this work
or at least bash out a proof of concept.
--
Craig Ringer
From | Date | Subject | |
---|---|---|---|
Next Message | Віталій Тимчишин | 2011-12-15 08:11:00 | Re: Re: [SQL] JDBC Statement.setQueryTimeout : is there plan to implement this? |
Previous Message | Craig Ringer | 2011-12-15 03:26:55 | Re: [SQL] JDBC Statement.setQueryTimeout : is there plan to implement this? |
From | Date | Subject | |
---|---|---|---|
Next Message | Віталій Тимчишин | 2011-12-15 08:11:00 | Re: Re: [SQL] JDBC Statement.setQueryTimeout : is there plan to implement this? |
Previous Message | Craig Ringer | 2011-12-15 03:26:55 | Re: [SQL] JDBC Statement.setQueryTimeout : is there plan to implement this? |