mpoeschl 2003/01/20 13:51:05
Modified: src/java/org/apache/torque/pool ConnectionPool.java
TorqueClassicDataSource.java
Log:
javadoc and checkstyle fixes
Revision Changes Path
1.24 +24 -14
jakarta-turbine-torque/src/java/org/apache/torque/pool/ConnectionPool.java
Index: ConnectionPool.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/pool/ConnectionPool.java,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -r1.23 -r1.24
--- ConnectionPool.java 9 Jan 2003 17:46:21 -0000 1.23
+++ ConnectionPool.java 20 Jan 2003 21:51:05 -0000 1.24
@@ -54,7 +54,6 @@
* <http://www.apache.org/>.
*/
-import java.io.PrintWriter;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
@@ -63,7 +62,6 @@
import javax.sql.ConnectionEventListener;
import javax.sql.ConnectionPoolDataSource;
import javax.sql.PooledConnection;
-
import org.apache.log4j.Logger;
/**
@@ -194,14 +192,14 @@
this.connectionWaitTimeout =
((connectionWaitTimeout > 0)
- ? connectionWaitTimeout * 1000
+ ? connectionWaitTimeout * 1000
: DEFAULT_CONNECTION_WAIT_TIMEOUT);
this.logInterval = 1000 * logInterval;
if (logInterval > 0)
{
- logger.debug("Starting Pool Monitor Thread with Log Interval "
+ logger.debug("Starting Pool Monitor Thread with Log Interval "
+ logInterval + " Milliseconds");
// Create monitor thread
@@ -222,7 +220,7 @@
* @param username The name of the database user.
* @param password The password of the database user.
* @return A database connection.
- * @exception SQLException
+ * @exception SQLException if there is aproblem with the db connection
*/
final synchronized PooledConnection getConnection(String username,
String password)
@@ -259,7 +257,7 @@
* <code>password</code>.
*
* @return A database connection.
- * @exception SQLException
+ * @exception SQLException if there is aproblem with the db connection
*/
private PooledConnection getNewConnection()
throws SQLException
@@ -283,13 +281,13 @@
// point calculation.
long currentTime = System.currentTimeMillis();
- double ratio =
- new Long(maxConnections - totalConnections).doubleValue() /
maxConnections;
+ double ratio = new Long(maxConnections - totalConnections).doubleValue()
+ / maxConnections;
- long ratioTime =
- new Double(currentTime - (expiryTime * ratio)/4).longValue();
+ long ratioTime = new Double(currentTime - (expiryTime * ratio) / 4)
+ .longValue();
- ratioTime = (expiryTime < 0 ) ? currentTime : ratioTime;
+ ratioTime = (expiryTime < 0) ? currentTime : ratioTime;
timeStamps.put(pc, new Long(ratioTime));
totalConnections++;
@@ -343,7 +341,7 @@
* creating a new connection.
*
* @return An existing or new database connection.
- * @exception Exception
+ * @throws Exception if the pool is empty
*/
private PooledConnection popConnection()
throws Exception
@@ -396,7 +394,7 @@
long birth = ((Long) timeStamps.get(pc)).longValue();
long age = System.currentTimeMillis() - birth;
- boolean dead = (expiryTime > 0)
+ boolean dead = (expiryTime > 0)
? age > expiryTime
: age > DEFAULT_EXPIRY_TIME;
@@ -515,6 +513,11 @@
notify();
}
+ /**
+ * Get the name of the pool
+ *
+ * @return the name of the pool
+ */
String getPoolName()
{
return toString();
@@ -625,8 +628,12 @@
*/
protected class Monitor extends Thread
{
+ /** true if the monot is running */
private boolean isRun = true;
+ /**
+ * run method for the monitor thread
+ */
public void run()
{
StringBuffer buf = new StringBuffer();
@@ -651,6 +658,9 @@
}
}
+ /**
+ * Shut down the monitor
+ */
public void shutdown()
{
isRun = false;
1.10 +22 -16
jakarta-turbine-torque/src/java/org/apache/torque/pool/TorqueClassicDataSource.java
Index: TorqueClassicDataSource.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/pool/TorqueClassicDataSource.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TorqueClassicDataSource.java 9 Jan 2003 15:52:52 -0000 1.9
+++ TorqueClassicDataSource.java 20 Jan 2003 21:51:05 -0000 1.10
@@ -124,7 +124,7 @@
/**
* time to wait when initiating a connection
- * for the database to respond
+ * for the database to respond
*/
private int connectionWaitTimeout;
@@ -133,7 +133,7 @@
/** Do connections from this pool are auto-committing? */
private boolean defaultAutoCommit;
-
+
/** Are connections from this pool read-only? */
private boolean defaultReadOnly;
@@ -171,7 +171,6 @@
this.defaultMaxConnections = v;
}
-
/**
* Get the number of database connections to cache per user. The keys
* are usernames and the value is the maximum connections. Any username
@@ -196,7 +195,6 @@
this.perUserMaxConnections = v;
}
-
/**
* Get the amount of time (in seconds) that database connections
* will be cached. The default is 3600 (1 hour).
@@ -219,7 +217,6 @@
this.maxExpiryTime = v;
}
-
/**
* Get the amount of time (in seconds) a connection request will
* have to wait before a time out occurs and an error is thrown.
@@ -244,7 +241,6 @@
this.connectionWaitTimeout = v;
}
-
/**
* Get the interval (in seconds) between which the ConnectionPool logs
* the status of it's Connections. Default is 0 which indicates no
@@ -431,8 +427,7 @@
*
* @param v Value to assign to connectionPoolDataSource.
*/
- public void
- setConnectionPoolDataSource(ConnectionPoolDataSource v)
+ public void setConnectionPoolDataSource(ConnectionPoolDataSource v)
{
if (v == null)
{
@@ -454,6 +449,7 @@
/**
* Attempt to establish a database connection.
*
+ * @return A database connection.
* @throws SQLException
*/
public Connection getConnection() throws SQLException
@@ -464,11 +460,12 @@
/**
* Attempt to establish a database connection.
*
- * @param username
- * @param password
+ * @param username The name of the database user.
+ * @param password The password of the database user.
+ * @return A database connection.
* @throws SQLException
*/
- synchronized public Connection getConnection(String username,
+ public synchronized Connection getConnection(String username,
String password)
throws SQLException
{
@@ -516,8 +513,8 @@
/**
*
- * @param username
- * @param password
+ * @param username The name of the database user.
+ * @param password The password of the database user.
* @throws javax.naming.NamingException
*/
synchronized private void registerPool(String username, String password)
@@ -553,7 +550,7 @@
}
ConnectionPool pool = new ConnectionPool(cpds, username, password,
- maxConnections,
+ maxConnections,
getMaxExpiryTime(),
getConnectionWaitTimeout(),
getLogInterval());
@@ -568,6 +565,8 @@
/**
* Gets the maximum time in seconds that this data source can wait
* while attempting to connect to a database.
+ *
+ * @return the login timeout
*/
public int getLoginTimeout()
{
@@ -577,6 +576,7 @@
/**
* Get the log writer for this data source.
*
+ * @return the log writer
* @deprecated Use correct debugging and logging code from Log4j
*/
public PrintWriter getLogWriter()
@@ -591,6 +591,8 @@
/**
* Sets the maximum time in seconds that this data source will wait
* while attempting to connect to a database. NOT USED.
+ *
+ * @param seconds the login timeout
*/
public void setLoginTimeout(int seconds)
{
@@ -600,6 +602,7 @@
/**
* Set the log writer for this data source.
*
+ * @param out the log writer to use
* @deprecated Use correct debugging and logging code from Log4j
*/
public void setLogWriter(java.io.PrintWriter out)
@@ -609,6 +612,9 @@
/**
* <CODE>Referenceable</CODE> implementation.
+ *
+ * @return a reference
+ * @throws NamingException
*/
public Reference getReference() throws NamingException
{
@@ -653,7 +659,7 @@
* @param name
* @param context
* @param env
- * @return
+ * @return an instance of this class
* @throws Exception
*/
public Object getObjectInstance(Object refObj, Name name,
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>