You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by fh...@apache.org on 2008/11/26 00:04:41 UTC
svn commit: r720643 - in
/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool:
ConnectionPool.java FairBlockingQueue.java
Author: fhanik
Date: Tue Nov 25 15:04:41 2008
New Revision: 720643
URL: http://svn.apache.org/viewvc?rev=720643&view=rev
Log:
Clean up a bit
Modified:
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
Modified: tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=720643&r1=720642&r2=720643&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original)
+++ tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Tue Nov 25 15:04:41 2008
@@ -127,6 +127,56 @@
return setupConnection(con);
}
+
+ /**
+ * Returns the name of this pool
+ * @return String
+ */
+ public String getName() {
+ return getPoolProperties().getPoolName();
+ }
+
+ /**
+ * Returns the pool properties associated with this connection pool
+ * @return PoolProperties
+ */
+ public PoolProperties getPoolProperties() {
+ return this.poolProperties;
+ }
+
+ /**
+ * Returns the total size of this pool, this includes both busy and idle connections
+ * @return int
+ */
+ public int getSize() {
+ return idle.size()+busy.size();
+ }
+
+ /**
+ * Returns the number of connections that are in use
+ * @return int
+ */
+ public int getActive() {
+ return busy.size();
+ }
+
+ public int getIdle() {
+ return idle.size();
+ }
+
+ /**
+ * Returns true if {@link #close close} has been called, and the connection pool is unusable
+ * @return boolean
+ */
+ public boolean isClosed() {
+ return this.closed;
+ }
+
+ //===============================================================================
+ // PROTECTED METHODS
+ //===============================================================================
+
+
protected Connection setupConnection(PooledConnection con) throws SQLException {
JdbcInterceptor handler = con.getHandler();
if (handler==null) {
@@ -178,49 +228,6 @@
}
- /**
- * Returns the name of this pool
- * @return String
- */
- public String getName() {
- return getPoolProperties().getPoolName();
- }
-
- /**
- * Returns the pool properties associated with this connection pool
- * @return PoolProperties
- */
- public PoolProperties getPoolProperties() {
- return this.poolProperties;
- }
-
- /**
- * Returns the total size of this pool, this includes both busy and idle connections
- * @return int
- */
- public int getSize() {
- return idle.size()+busy.size();
- }
-
- /**
- * Returns the number of connections that are in use
- * @return int
- */
- public int getActive() {
- return busy.size();
- }
-
- public int getIdle() {
- return idle.size();
- }
-
- /**
- * Returns true if {@link #close close} has been called, and the connection pool is unusable
- * @return boolean
- */
- public boolean isClosed() {
- return this.closed;
- }
@Override
protected void finalize() throws Throwable {
@@ -268,9 +275,6 @@
} //closePool
- //===============================================================================
- // PROTECTED METHODS
- //===============================================================================
/**
* Initialize the connection pool - called from the constructor
* @param properties PoolProperties - properties used to initialize the pool with
@@ -703,7 +707,7 @@
size.addAndGet(-1);
}
- public void startJmx() {
+ protected void startJmx() {
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = new ObjectName("org.apache.tomcat.jdbc.pool.jmx:type=ConnectionPool,name="+getName());
@@ -713,7 +717,7 @@
}
}
- public void stopJmx() {
+ protected void stopJmx() {
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
ObjectName name = new ObjectName("org.apache.tomcat.jdbc.pool.jmx:type=ConnectionPool,name="+getName());
Modified: tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java?rev=720643&r1=720642&r2=720643&view=diff
==============================================================================
--- tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java (original)
+++ tomcat/trunk/modules/jdbc-pool/java/org/apache/tomcat/jdbc/pool/FairBlockingQueue.java Tue Nov 25 15:04:41 2008
@@ -335,7 +335,7 @@
//------------------------------------------------------------------
- // Future used to check and see if a connection has been made available
+ // Non cancellable Future used to check and see if a connection has been made available
//------------------------------------------------------------------
protected class ItemFuture<T> implements Future<T> {
protected volatile T item = null;
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org