commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mark archur <goodguy_...@yahoo.com>
Subject Re: [dbcp] meanings of active, idle
Date Fri, 24 Jun 2005 18:49:11 GMT

Dirk/All,

Thanks for the reply.

Your definition of "Active" (and also "Idle") looks convincing to me, but my tests do not
prove the same. We know that there is a parameter called “initialSize” introduced in version
1.2. I set initialSize to 12. In my program, when I print getNumActive(), it gives me a value
12. 

If I understand the meaning of initialSize, it should JUST create connections in the pool
and the connection should not yet be open (active) right?? The fact that it getNumActive()
gave me value 12, does it mean it has 12 active connections(connections which are open by
the program)?

AND, when I call basicDataSource.getConnection(), it returns me a connection right. Now, before
closing this connection, I called getNumActive(), it prints 13. Does this prove that having
initialSize in the settings really creates 12 ACTIVE (open-but-not-yet-closed) connections?

 

FYI: I am creating the basicDataSource by invoking BasicDataSourceFactory.createDataSource(Properties)
method. And I cache basicDataSource so I can reuse it.

 

Am I missing anything basic here.

 

Thanks,

 

Pramodh.


Dirk Verbeeck <dirk.verbeeck@pandora.be> wrote:A connection is active when it is being
used by the program. It was 
borrowed from the pool by db.getConnection() and hasn't been returned to 
the pool yet by con.close().
When a connection has been returned to the pool by con.close() then a 
connection is considered idle.

A connection that is reallyClosed (the plysical connection to the 
database), isn't in the statistics anymore. A connection will really be 
closed by the pool if the maxIdle limit is reached and in other similar 
cases. Normally the program using the pool just borrows/returns 
connection frm/to the pool.

-- Dirk

mark archur wrote:
> Hi,
> I am using commons-dbcp and its going well so far. But, I am not 100% clear of what exactly
an active, idle connection mean (and not sure if its meaning changes in the context of pool).
Let me tell what I understand:
> Active: A connection is said to be active if a connection is open and is not closed yet.
In the context of pool, does the meaning change?
> Idle: I am guessing a connection to be idle should be closed. But, not sure when can
it be idle. Again, does the meaning change in the context of pool?
> 
> Thanks.



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-user-help@jakarta.apache.org



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
Mime
  • Unnamed multipart/alternative (inline, 8-Bit, 0 bytes)
View raw message