You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2019/03/29 23:39:51 UTC

[commons-pool] branch master updated: Fix for POOL-363 (#20)

This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-pool.git


The following commit(s) were added to refs/heads/master by this push:
     new f9220a6  Fix for POOL-363 (#20)
f9220a6 is described below

commit f9220a694552e1df41990913ee80c8021bdfbf34
Author: Josh Landin <jo...@users.noreply.github.com>
AuthorDate: Fri Mar 29 19:39:47 2019 -0400

    Fix for POOL-363 (#20)
    
    Updated evictor thread to be a daemon, thus no longer blocking
    application hooks (added via Runtime.addShutdownHook) and causing the VM
    to hang on shutdown. For example, stand-alone applications using the
    Spring Framework.
---
 src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java b/src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java
index 86e5b54..dbd45d5 100644
--- a/src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java
+++ b/src/main/java/org/apache/commons/pool2/impl/EvictionTimer.java
@@ -113,14 +113,14 @@ class EvictionTimer {
     }
 
     /**
-     * Thread factory that creates a thread, with the context class loader from this class.
+     * Thread factory that creates a daemon thread, with the context class loader from this class.
      */
     private static class EvictorThreadFactory implements ThreadFactory {
 
         @Override
         public Thread newThread(final Runnable runnable) {
             final Thread thread = new Thread(null, runnable, "commons-pool-evictor-thread");
-
+            thread.setDaemon(true); // POOL-363 - Required for applications using Runtime.addShutdownHook(). --joshlandin 03.27.2019 
             AccessController.doPrivileged(new PrivilegedAction<Void>() {
                 @Override
                 public Void run() {