You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2009/04/01 19:10:16 UTC

svn commit: r760963 - /commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/EvictionTimer.java

Author: markt
Date: Wed Apr  1 17:10:15 2009
New Revision: 760963

URL: http://svn.apache.org/viewvc?rev=760963&view=rev
Log:
Fix POOL-121. Give the timer thread a more meaningful name.

Modified:
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/EvictionTimer.java

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/EvictionTimer.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/EvictionTimer.java?rev=760963&r1=760962&r2=760963&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/EvictionTimer.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/EvictionTimer.java Wed Apr  1 17:10:15 2009
@@ -37,7 +37,16 @@
 class EvictionTimer {
     private static Timer _timer;
     private static int _usageCount;
-    
+    /*
+     * _timer is static so there may be one per class loader. Append a unique
+     * class loader name to the timer name. Don't use toString() since the class
+     * loader may have overridden that method.
+     */
+    private static final String TIMER_THREAD_NAME =
+        "Commons Pool Eviction Timer for " +
+        EvictionTimer.class.getClassLoader().getClass().getName() + "@" +
+        Integer.toHexString(EvictionTimer.class.getClassLoader().getClass().hashCode());
+
     private EvictionTimer() {
         // Hide the default constuctor
     }
@@ -53,7 +62,7 @@
      */
     static synchronized void schedule(TimerTask task, long delay, long period) {
         if (null == _timer) {
-            _timer = new Timer(true);
+            _timer = new Timer(TIMER_THREAD_NAME, true);
         }
         _usageCount++;
         _timer.schedule(task, delay, period);