commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Saravanan Bellan <Saravanan.Bel...@veritas.com>
Subject DBCP Connection recycling
Date Tue, 08 Apr 2003 21:44:50 GMT
I want the connections in my pool to be recycled after a certain period
of time or certain number of connections. What I mean by recycle is close
the
actual connection and open a new one. The reason for this is that Postgres
on windows leaks semaphore handles if the same connection is being used for
extended period of time.

I was thinking that the removeAbandoned parameter would do something, but it
kicks in
only during some extreme cases, like the numIdle < 2  and numActive is
closer
to maxActive.


    public synchronized Object borrowObject() throws Exception {
        try {
            if (config != null
                    && config.getRemoveAbandoned()
                    && (getNumIdle() < 2)
                    && (getNumActive() > getMaxActive() - 3) ) {
                removeAbandoned();
            }

I want to be able to recycle the connection irrespective of idle
and active connections.

Is there a way to do it? If not can it be taken as a valid enhancement
request(a new parameter timetolive, for eg.)

Mime
View raw message