netbattle.database
Class ConnectionPool

java.lang.Object
  extended by netbattle.database.ConnectionPool

public class ConnectionPool
extends java.lang.Object


Constructor Summary
ConnectionPool(java.lang.String url, int size)
          Creates a new ConnectionPool that connects to the given url.
 
Method Summary
 void close()
          Close all of the Connections in this pool.
protected  void finalize()
          Finalise this pool.
 java.sql.Connection getConnection()
          Get a Connection object for exclusive use.
 void returnConnection(java.sql.Connection conn)
          Return a Connection object that was obtained with getConnection() to the pool.
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConnectionPool

public ConnectionPool(java.lang.String url,
                      int size)
               throws java.sql.SQLException
Creates a new ConnectionPool that connects to the given url.

Parameters:
url - the url to connection to
size - the initial size of the pool
Throws:
java.sql.SQLException - if a connection could not be established
Method Detail

close

public void close()
Close all of the Connections in this pool.


finalize

protected void finalize()
Finalise this pool.

Overrides:
finalize in class java.lang.Object

getConnection

public java.sql.Connection getConnection()
Get a Connection object for exclusive use. In order to allow other objects to use this Connection, the caller should return to it the pool by calling ConnectionPool.returnConnection().


returnConnection

public void returnConnection(java.sql.Connection conn)
Return a Connection object that was obtained with getConnection() to the pool.