Hi,

You need to set the thread's interrupted status after catching InterruptedException. Thus the catch clause should contain

    Thread.currentThread().interrupt();

See http://michaelscharf.blogspot.it/2006/09/dont-swallow-interruptedexception-call.html, which sums it up pretty nicely.

Michael


On 8.5.15 11:51 , [email protected] wrote:
Author: davide
Date: Fri May  8 09:51:51 2015
New Revision: 1678321

URL: http://svn.apache.org/r1678321
Log:
OAK-2854 - provide more insight on executors during shutdown

- added try-catch and Logging.

Modified:
     
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java

Modified: 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java
URL: 
http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java?rev=1678321&r1=1678320&r2=1678321&view=diff
==============================================================================
--- 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java 
(original)
+++ 
jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/Oak.java 
Fri May  8 09:51:51 2015
@@ -684,7 +684,17 @@ public class Oak {

          @Override
          public void close() throws IOException {
-            executorService.shutdown();
+            try {
+                executorService.shutdown();
+                executorService.awaitTermination(5, TimeUnit.SECONDS);
+            } catch (InterruptedException e) {
+                LOG.error("Error while shutting down the executorService", e);
+            } finally {
+                if (!executorService.isTerminated()) {
+                    LOG.warn("executorService didn't shutdown properly. Will be 
forced now.");
+                }
+                executorService.shutdownNow();
+            }
          }
      }



Reply via email to