title: What is maxWait in Apache DBCP?
body: <p>I'm trying to understand what <strong>maxWait</strong> is in org.apache.commons.dbcp.BasicDataSource. <a href="http://commons.apache.org/proper/commons-dbcp/api-1.4/org/apache/commons/dbcp/BasicDataSource.html" rel="nofollow">Documentation</a> said that it is:</p>
  
  <blockquote>
    <p>The maximum number of milliseconds that the pool will wait (when there
    are no available connections) for a connection to be returned before
    throwing an exception, or &lt;= 0 to wait indefinitely.</p>
  </blockquote>
  
  <p>But I still can't understand. I tried to google it, but my doubts only increased.</p>
  
  <p>I see two ways to interpret this definition:</p>
  
  <ol>
  <li>maxWait is the maximum number of milliseconds that an application that uses this pool will wait until it gets an exception, if the pool does not have free connections to return to the application. I.e. if pool has no free connections application will wait for this amount of time for a new connection until it gets an exception.</li>
  <li>maxWait is the maximum number of milliseconds that connection can be opened. If such connection is not closed for this amount of time, pool will raise an exception.</li>
  </ol>
  
  <p>Please help me to understand which statement is true.
  Or may be there is some other definition :)</p>