commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r566026 - in /commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool: PoolClientThread.java PoolSoak.java WaiterFactory.java
Date Wed, 15 Aug 2007 05:00:36 GMT
Author: psteitz
Date: Tue Aug 14 22:00:35 2007
New Revision: 566026

URL: http://svn.apache.org/viewvc?view=rev&rev=566026
Log:
Moved misplaced pool initialialization, added more logging.

Modified:
    commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java
    commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolSoak.java
    commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/WaiterFactory.java

Modified: commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java?view=diff&rev=566026&r1=566025&r2=566026
==============================================================================
--- commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java
(original)
+++ commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolClientThread.java
Tue Aug 14 22:00:35 2007
@@ -59,12 +59,6 @@
         this.pool = pool;
     }
     
-    /** put a few instances into the pool to start */
-    protected void init() throws Exception {
-        for (int i = 0; i < 10; i++) {
-            pool.addObject();
-        }
-    }
     /** Borrow and return */
     public void execute() throws Exception {
        Waiter waiter = (Waiter) pool.borrowObject(); 

Modified: commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolSoak.java
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolSoak.java?view=diff&rev=566026&r1=566025&r2=566026
==============================================================================
--- commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolSoak.java
(original)
+++ commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/PoolSoak.java
Tue Aug 14 22:00:35 2007
@@ -139,6 +139,21 @@
         // Create factory
         pool.setFactory(new WaiterFactory(activateLatency, destroyLatency,
                 makeLatency, passivateLatency, validateLatency, waiterLatency)); 
+        logger.info("Initialized pool with properties: ");
+        logger.info(" exhaustedAction: " + pool.getWhenExhaustedAction());
+        logger.info(" maxActive: " + pool.getMaxActive());
+        logger.info(" maxIdle: " + pool.getMaxIdle());
+        logger.info(" minIdle: " + pool.getMinIdle());
+        logger.info(" testOnBorrow: " + pool.getTestOnBorrow());
+        logger.info(" testWhileIdle: " + pool.getTestWhileIdle());
+        logger.info(" timeBetweenEvictions: " + pool.getTimeBetweenEvictionRunsMillis());
+        logger.info(" testsPerEviction: " + pool.getNumTestsPerEvictionRun());
+        logger.info(" idleTimeout: " + pool.getMinEvictableIdleTimeMillis());
+        
+        // put a few instances in the pool to start
+        for (int i = 0; i < 10; i++) {
+            pool.addObject();
+        }
     }
     
     /**

Modified: commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/WaiterFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/WaiterFactory.java?view=diff&rev=566026&r1=566025&r2=566026
==============================================================================
--- commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/WaiterFactory.java
(original)
+++ commons/sandbox/performance/trunk/src/java/org/apache/commons/performance/pool/WaiterFactory.java
Tue Aug 14 22:00:35 2007
@@ -17,6 +17,10 @@
 
 package org.apache.commons.performance.pool;
 
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+import org.apache.commons.performance.LoadGenerator;
 import org.apache.commons.pool.PoolableObjectFactory;
 
 /**
@@ -32,6 +36,9 @@
     private long passivateLatency = 0;
     private long validateLatency = 0;
     private long waiterLatency = 0;
+    
+    protected static final Logger logger = 
+        Logger.getLogger(WaiterFactory.class.getName());
 
     public WaiterFactory(long activateLatency, long destroyLatency,
             long makeLatency, long passivateLatency, long validateLatency,
@@ -45,25 +52,40 @@
     }
 
     public void activateObject(Object arg0) throws Exception {
+        if (logger.isLoggable(Level.FINEST)) {
+            logger.finest("activate");
+        }
         doWait(activateLatency);
     }
 
     public void destroyObject(Object arg0) throws Exception {
+        if (logger.isLoggable(Level.FINE)) {
+            logger.fine("destroy");
+        }
         doWait(destroyLatency);
         ((Waiter) arg0).setValid(false);
     }
 
     public Object makeObject() throws Exception {
+        if (logger.isLoggable(Level.FINE)) {
+            logger.fine("makeObject");
+        }
         doWait(makeLatency);
         return new Waiter(false, true, waiterLatency);
     }
 
     public void passivateObject(Object arg0) throws Exception {
+        if (logger.isLoggable(Level.FINEST)) {
+            logger.finest("passivate");
+        }
         ((Waiter) arg0).setActive(false);
         doWait(passivateLatency);
     }
 
     public boolean validateObject(Object arg0) {
+        if (logger.isLoggable(Level.FINE)) {
+            logger.fine("validate");
+        }
         doWait(validateLatency);
         return ((Waiter) arg0).isValid();
     }



Mime
View raw message