From ed19117078f269028d9cf28733bbc3930e953e19 Mon Sep 17 00:00:00 2001 From: "Erik C. Thauvin" Date: Wed, 17 Mar 2004 23:35:36 +0000 Subject: [PATCH] More Javadoc fixes. --- src/net/java/dev/simplepool/SimplePool.java | 36 ++++++++----------- .../dev/simplepool/SimplePoolConnection.java | 6 ++-- .../dev/simplepool/SimplePoolServlet.java | 7 ++-- 3 files changed, 22 insertions(+), 27 deletions(-) diff --git a/src/net/java/dev/simplepool/SimplePool.java b/src/net/java/dev/simplepool/SimplePool.java index e03999e..eae8267 100644 --- a/src/net/java/dev/simplepool/SimplePool.java +++ b/src/net/java/dev/simplepool/SimplePool.java @@ -78,8 +78,8 @@ public class SimplePool implements Runnable { * * @throws IOException If the pool cannot be created. */ - public SimplePool(String driver, String jdbcUrl, String user, - String password, int minConns, int maxConns, double maxConnTime, int maxCheckoutSeconds) + public SimplePool(String driver, String jdbcUrl, String user, String password, int minConns, int maxConns, + double maxConnTime, int maxCheckoutSeconds) throws IOException { this.connPool = new Connection[maxConns]; @@ -129,8 +129,7 @@ public class SimplePool implements Runnable { break; } catch (SQLException e) { - log.error("Attempt (" + String.valueOf(i) + - " of " + String.valueOf(dbLoop) + + log.error("Attempt (" + String.valueOf(i) + " of " + String.valueOf(dbLoop) + ") failed to create new connections set at startup.", e); log.warn("Will try again in 15 seconds..."); @@ -197,15 +196,11 @@ public class SimplePool implements Runnable { if (connStatus[i] > 0) { // In use, catch it next time! // Check the time it's been checked out and recycle - long timeInUse = System.currentTimeMillis() - - connLockTime[i]; - log.warn("Connection [" + i + - "] in use for " + timeInUse + - " ms."); + long timeInUse = System.currentTimeMillis() - connLockTime[i]; + log.warn("Connection [" + i + "] in use for " + timeInUse + " ms."); if (maxCheckoutMillis != 0) { if (timeInUse > maxCheckoutMillis) { - log.warn("Connection [" + - i + "] failed to be returned in time. Recycling..."); + log.warn("Connection [" + i + "] failed to be returned in time. Recycling..."); throw new SQLException(); } } @@ -237,7 +232,8 @@ public class SimplePool implements Runnable { try { connPool[i].close(); } catch (SQLException e0) { - log.warn("Can't close connection [" + String.valueOf(i) + "]. Might have been closed already. Trying to recycle anyway...", e); + log.warn("Can't close connection [" + String.valueOf(i) + + "]. Might have been closed already. Trying to recycle anyway...", e); } try { @@ -303,8 +299,7 @@ public class SimplePool implements Runnable { do { synchronized (connStatus) { - if ((connStatus[roundRobin] < 1) && - (!connPool[roundRobin].isClosed())) { + if ((connStatus[roundRobin] < 1) && (!connPool[roundRobin].isClosed())) { conn = connPool[roundRobin]; connStatus[roundRobin] = 1; connLockTime[roundRobin] = System.currentTimeMillis(); @@ -330,7 +325,6 @@ public class SimplePool implements Runnable { } else { synchronized (this) { // Add new connections to the pool if (currConnections < maxConns) { - try { createConn(currConnections); currConnections++; @@ -346,8 +340,7 @@ public class SimplePool implements Runnable { ; } - log.debug("Connections Exhausted. Will wait and try again in loop " + - String.valueOf(outerloop)); + log.debug("Connections Exhausted. Will wait and try again in loop " + String.valueOf(outerloop)); } } // End of try 10 times loop @@ -356,8 +349,7 @@ public class SimplePool implements Runnable { log.debug("Unsuccessful getConnection() request during destroy()"); } // End if(available) - log.debug("Handing out connection [" + - idOfConnection(conn) + "]: " + + log.debug("Handing out connection [" + idOfConnection(conn) + "]: " + (new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a")).format(new Date())); return conn; @@ -444,8 +436,7 @@ public class SimplePool implements Runnable { log.debug("Error creating connection. The driver could not be loaded.", e2); } - log.debug("Opening connection [" + String.valueOf(i) + - "]: " + connPool[i].toString()); + log.debug("Opening connection [" + String.valueOf(i) + "]: " + connPool[i].toString()); } /** @@ -520,7 +511,8 @@ public class SimplePool implements Runnable { if (useCount > 0) { //bt-test successful - String msg = "Unsafe shutdown: Had to close " + useCount + " active DB connections after " + millis + "ms."; + String msg = "Unsafe shutdown: Had to close " + useCount + " active DB connections after " + millis + + "ms."; log.error(msg); // Throwing following Exception is essential because servlet authors // are likely to have their own error logging requirements. diff --git a/src/net/java/dev/simplepool/SimplePoolConnection.java b/src/net/java/dev/simplepool/SimplePoolConnection.java index ac9633d..8dada04 100644 --- a/src/net/java/dev/simplepool/SimplePoolConnection.java +++ b/src/net/java/dev/simplepool/SimplePoolConnection.java @@ -276,7 +276,8 @@ public class SimplePoolConnection implements Connection { /** * See {@link java.sql.Connection#prepareCall(String, int, int, int)}. */ - public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) + public CallableStatement prepareCall(String sql, int resultSetType, int resultSetConcurrency, + int resultSetHoldability) throws SQLException { return conn.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability); } @@ -308,7 +309,8 @@ public class SimplePoolConnection implements Connection { /** * See {@link java.sql.Connection#prepareStatement(String, int, int, int)}. */ - public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) + public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, + int resultSetHoldability) throws SQLException { return conn.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability); } diff --git a/src/net/java/dev/simplepool/SimplePoolServlet.java b/src/net/java/dev/simplepool/SimplePoolServlet.java index bf64a9e..098e629 100644 --- a/src/net/java/dev/simplepool/SimplePoolServlet.java +++ b/src/net/java/dev/simplepool/SimplePoolServlet.java @@ -76,7 +76,8 @@ public class SimplePoolServlet extends HttpServlet { * The required intialization parameters are: *

*