incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r1569397 - in /sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl: dea/ jobs/ jobs/deprecated/ jobs/queues/ jobs/timed/
Date Tue, 18 Feb 2014 15:48:56 GMT
Author: cziegeler
Date: Tue Feb 18 15:48:55 2014
New Revision: 1569397

URL: http://svn.apache.org/r1569397
Log:
SLING-3383 : Non stopping thread in AbstractJobQueue causes classloader leak 

Modified:
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventReceiver.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventSender.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/BackgroundLoader.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobSchedulerImpl.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/deprecated/EventAdminBridge.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractParallelJobQueue.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/OrderedJobQueue.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/ParallelJobQueue.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/TopicRoundRobinJobQueue.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/TimedEventReceiver.java
    sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/TimedEventSender.java

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventReceiver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventReceiver.java?rev=1569397&r1=1569396&r2=1569397&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventReceiver.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventReceiver.java
Tue Feb 18 15:48:55 2014
@@ -138,6 +138,7 @@ public class DistributedEventReceiver
             this.writeQueue.put(new Event(Utility.TOPIC_STOPPED, (Dictionary<String, Object>)null));
         } catch (final InterruptedException e) {
             this.ignoreException(e);
+            Thread.currentThread().interrupt();
         }
     }
 
@@ -151,8 +152,9 @@ public class DistributedEventReceiver
             try {
                 event = this.writeQueue.take();
             } catch (final InterruptedException e) {
-                // we ignore this
                 this.ignoreException(e);
+                Thread.currentThread().interrupt();
+                this.running = false;
             }
             if ( event != null && this.running ) {
                 try {
@@ -219,8 +221,8 @@ public class DistributedEventReceiver
         try {
             this.writeQueue.put(event);
         } catch (final InterruptedException ex) {
-            // we ignore this
             this.ignoreException(ex);
+            Thread.currentThread().interrupt();
         }
     }
 

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventSender.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventSender.java?rev=1569397&r1=1569396&r2=1569397&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventSender.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/dea/DistributedEventSender.java
Tue Feb 18 15:48:55 2014
@@ -103,6 +103,7 @@ public class DistributedEventSender
             this.queue.put("");
         } catch (final InterruptedException e) {
             this.ignoreException(e);
+            Thread.currentThread().interrupt();
         }
     }
 
@@ -159,8 +160,9 @@ public class DistributedEventSender
             try {
                 path = this.queue.take();
             } catch (final InterruptedException e) {
-                // we ignore this
                 this.ignoreException(e);
+                Thread.currentThread().interrupt();
+                this.running = false;
             }
             if ( path != null && path.length() > 0 && this.running ) {
                 ResourceResolver resolver = null;
@@ -203,8 +205,8 @@ public class DistributedEventSender
             try {
                 this.queue.put(path);
             } catch (final InterruptedException ex) {
-                // we ignore this
                 this.ignoreException(ex);
+                Thread.currentThread().interrupt();
             }
         }
     }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/BackgroundLoader.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/BackgroundLoader.java?rev=1569397&r1=1569396&r2=1569397&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/BackgroundLoader.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/BackgroundLoader.java
Tue Feb 18 15:48:55 2014
@@ -155,6 +155,7 @@ public class BackgroundLoader implements
             this.actionQueue.put(END_TOKEN);
         } catch (final InterruptedException e) {
             this.ignoreException(e);
+            Thread.currentThread().interrupt();
         }
     }
 
@@ -178,7 +179,8 @@ public class BackgroundLoader implements
                     try {
                         this.loadLock.wait();
                     } catch (final InterruptedException e) {
-                        // ignore
+                        Thread.currentThread().interrupt();
+                        this.active.set(false);
                     }
                 }
                 startTime = System.currentTimeMillis();
@@ -190,7 +192,8 @@ public class BackgroundLoader implements
                     try {
                         this.stopLock.wait(1000 * this.configuration.getBackgroundLoadDelay());
                     } catch (final InterruptedException e) {
-                        // ignore
+                        Thread.currentThread().interrupt();
+                        this.active.set(false);
                     }
                 }
             }
@@ -210,6 +213,8 @@ public class BackgroundLoader implements
                     nextPathOrJob = this.actionQueue.take();
                 } catch (final InterruptedException e) {
                     this.ignoreException(e);
+                    Thread.currentThread().interrupt();
+                    this.active.set(false);
                 }
                 if ( nextPathOrJob instanceof JobImpl ) {
                     this.jobManager.process((JobImpl)nextPathOrJob);
@@ -371,8 +376,10 @@ public class BackgroundLoader implements
                             if ( isRunning() ) {
                                 try {
                                     actionQueue.put(iter.next());
-                                } catch (InterruptedException e) {
+                                } catch (final InterruptedException e) {
                                     ignoreException(e);
+                                    Thread.currentThread().interrupt();
+                                    running = false;
                                 }
                             }
                         }
@@ -394,6 +401,7 @@ public class BackgroundLoader implements
                     this.actionQueue.put(path);
                 } catch (final InterruptedException e) {
                     this.ignoreException(e);
+                    Thread.currentThread().interrupt();
                 }
             }
         }
@@ -409,6 +417,7 @@ public class BackgroundLoader implements
                     this.actionQueue.put(job);
                 } catch (final InterruptedException e) {
                     this.ignoreException(e);
+                    Thread.currentThread().interrupt();
                 }
             }
         }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobSchedulerImpl.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobSchedulerImpl.java?rev=1569397&r1=1569396&r2=1569397&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobSchedulerImpl.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/JobSchedulerImpl.java
Tue Feb 18 15:48:55 2014
@@ -142,6 +142,7 @@ public class JobSchedulerImpl
             this.queue.put(new Event(Utility.TOPIC_STOPPED, (Dictionary<String, Object>)null));
         } catch (final InterruptedException e) {
             this.ignoreException(e);
+            Thread.currentThread().interrupt();
         }
     }
 
@@ -174,8 +175,9 @@ public class JobSchedulerImpl
                 try {
                     event = this.queue.take();
                 } catch (final InterruptedException e) {
-                    // we ignore this
                     this.ignoreException(e);
+                    Thread.currentThread().interrupt();
+                    this.running = false;
                 }
             }
             if ( event != null && this.running ) {
@@ -370,8 +372,8 @@ public class JobSchedulerImpl
                                                 try {
                                                     queue.put(result.event);
                                                 } catch (InterruptedException e) {
-                                                    // we ignore this exception as this should
never occur
                                                     ignoreException(e);
+                                                    Thread.currentThread().interrupt();
                                                 }
                                             }
                                         }
@@ -402,6 +404,7 @@ public class JobSchedulerImpl
                         this.queue.put(event);
                     } catch (final InterruptedException ignore) {
                         this.ignoreException(ignore);
+                        Thread.currentThread().interrupt();
                     }
                 }
             }
@@ -446,6 +449,7 @@ public class JobSchedulerImpl
                                 this.queue.put(readResult.event);
                             } catch (final InterruptedException e) {
                                 this.ignoreException(e);
+                                Thread.currentThread().interrupt();
                             }
                         }
                     }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/deprecated/EventAdminBridge.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/deprecated/EventAdminBridge.java?rev=1569397&r1=1569396&r2=1569397&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/deprecated/EventAdminBridge.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/deprecated/EventAdminBridge.java
Tue Feb 18 15:48:55 2014
@@ -104,6 +104,7 @@ public class EventAdminBridge
         try {
             this.writeQueue.put(new Event("deactivate", (Dictionary<String, Object>)null));
         } catch (final InterruptedException e) {
+            Thread.currentThread().interrupt();
             this.ignoreException(e);
         }
         logger.info("Apache Sling Job Event Bridge stopped on instance {}", Environment.APPLICATION_ID);
@@ -142,8 +143,9 @@ public class EventAdminBridge
             try {
                 event = this.writeQueue.take();
             } catch (final InterruptedException e) {
-                // we ignore this
                 this.ignoreException(e);
+                Thread.currentThread().interrupt();
+                this.running = false;
             }
             if ( event != null && this.running ) {
                 final JobManager jm = this.jobManager;
@@ -153,6 +155,8 @@ public class EventAdminBridge
                         Thread.sleep(500);
                     } catch (final InterruptedException ie) {
                         this.ignoreException(ie);
+                        Thread.currentThread().interrupt();
+                        this.running = false;
                     }
                 } else {
                     final String jobTopic = (String)event.getProperty(ResourceHelper.PROPERTY_JOB_TOPIC);
@@ -193,8 +197,8 @@ public class EventAdminBridge
                 try {
                     this.writeQueue.put(event);
                 } catch (final InterruptedException e) {
-                    // this should never happen
                     this.ignoreException(e);
+                    Thread.currentThread().interrupt();
                 }
             } else {
                 this.logger.warn(errorMessage + " : {}", EventUtil.toString(event));

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java?rev=1569397&r1=1569396&r2=1569397&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractJobQueue.java
Tue Feb 18 15:48:55 2014
@@ -262,9 +262,9 @@ public abstract class AbstractJobQueue
             if ( restartJobs.size() > 0 ) {
                 try {
                     Thread.sleep(500);
-                } catch (InterruptedException e) {
-                    // we just ignore this
+                } catch (final InterruptedException e) {
                     this.ignoreException(e);
+                    Thread.currentThread().interrupt();
                 }
             }
             final Iterator<JobHandler> jobIter = restartJobs.iterator();
@@ -482,6 +482,7 @@ public abstract class AbstractJobQueue
                     this.suspendLock.wait(MAX_SUSPEND_TIME);
                 } catch (final InterruptedException ignore) {
                     this.ignoreException(ignore);
+                    Thread.currentThread().interrupt();
                 }
                 if ( System.currentTimeMillis() > this.suspendedSince + MAX_SUSPEND_TIME
) {
                     this.resume();

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractParallelJobQueue.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractParallelJobQueue.java?rev=1569397&r1=1569396&r2=1569397&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractParallelJobQueue.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/AbstractParallelJobQueue.java
Tue Feb 18 15:48:55 2014
@@ -84,6 +84,7 @@ public abstract class AbstractParallelJo
                         this.syncLock.wait();
                     } catch (final InterruptedException e) {
                         this.ignoreException(e);
+                        Thread.currentThread().interrupt();
                     }
                 }
                 this.logger.debug("Job queue {} is continuing.", this.queueName);

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/OrderedJobQueue.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/OrderedJobQueue.java?rev=1569397&r1=1569396&r2=1569397&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/OrderedJobQueue.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/OrderedJobQueue.java
Tue Feb 18 15:48:55 2014
@@ -95,8 +95,9 @@ public final class OrderedJobQueue exten
                 while ( this.isWaiting ) {
                     try {
                         this.syncLock.wait();
-                    } catch (InterruptedException e) {
+                    } catch (final InterruptedException e) {
                         this.ignoreException(e);
+                        Thread.currentThread().interrupt();
                     }
                 }
                 this.logger.debug("Job queue {} is continuing.", this.queueName);
@@ -142,6 +143,7 @@ public final class OrderedJobQueue exten
                     this.queue.wait();
                 } catch (final InterruptedException e) {
                     this.ignoreException(e);
+                    Thread.currentThread().interrupt();
                 }
                 this.isWaitingForNext = false;
             }
@@ -184,6 +186,7 @@ public final class OrderedJobQueue exten
                     this.sleepLock.wait(delay);
                 } catch (final InterruptedException e) {
                     this.ignoreException(e);
+                    Thread.currentThread().interrupt();
                 }
                 this.sleepLock.sleepingSince = -1;
                 final JobHandler result = this.sleepLock.jobHandler;

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/ParallelJobQueue.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/ParallelJobQueue.java?rev=1569397&r1=1569396&r2=1569397&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/ParallelJobQueue.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/ParallelJobQueue.java
Tue Feb 18 15:48:55 2014
@@ -55,8 +55,8 @@ public final class ParallelJobQueue exte
             this.isWaitingForNext = false;
             this.queue.put(event);
         } catch (final InterruptedException e) {
-            // this should never happen
             this.ignoreException(e);
+            Thread.currentThread().interrupt();
         }
     }
 
@@ -66,8 +66,8 @@ public final class ParallelJobQueue exte
             this.isWaitingForNext = true;
             return this.queue.take();
         } catch (final InterruptedException e) {
-            // this should never happen
             this.ignoreException(e);
+            Thread.currentThread().interrupt();
         } finally {
             this.isWaitingForNext = false;
         }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/TopicRoundRobinJobQueue.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/TopicRoundRobinJobQueue.java?rev=1569397&r1=1569396&r2=1569397&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/TopicRoundRobinJobQueue.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/queues/TopicRoundRobinJobQueue.java
Tue Feb 18 15:48:55 2014
@@ -100,6 +100,7 @@ public final class TopicRoundRobinJobQue
                         this.topicMap.wait();
                     } catch (final InterruptedException ie) {
                         this.ignoreException(ie);
+                        Thread.currentThread().interrupt();
                     }
                 }
             }

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/TimedEventReceiver.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/TimedEventReceiver.java?rev=1569397&r1=1569396&r2=1569397&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/TimedEventReceiver.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/TimedEventReceiver.java
Tue Feb 18 15:48:55 2014
@@ -125,6 +125,7 @@ public class TimedEventReceiver implemen
             this.writeQueue.put(new Event(Utility.TOPIC_STOPPED, (Dictionary<String, Object>)null));
         } catch (final InterruptedException e) {
             this.ignoreException(e);
+            Thread.currentThread().interrupt();
         }
     }
 
@@ -137,8 +138,9 @@ public class TimedEventReceiver implemen
             try {
                 event = this.writeQueue.take();
             } catch (final InterruptedException e) {
-                // we ignore this
                 this.ignoreException(e);
+                Thread.currentThread().interrupt();
+                this.running = false;
             }
             if ( this.running && event != null ) {
                 // check for schedule info
@@ -251,8 +253,8 @@ public class TimedEventReceiver implemen
         try {
             this.writeQueue.put(event);
         } catch (final InterruptedException e) {
-            // this should never happen
             this.ignoreException(e);
+            Thread.currentThread().interrupt();
         }
     }
 

Modified: sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/TimedEventSender.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/TimedEventSender.java?rev=1569397&r1=1569396&r2=1569397&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/TimedEventSender.java
(original)
+++ sling/trunk/bundles/extensions/event/src/main/java/org/apache/sling/event/impl/jobs/timed/TimedEventSender.java
Tue Feb 18 15:48:55 2014
@@ -158,6 +158,7 @@ public class TimedEventSender
             this.queue.put(new Event(Utility.TOPIC_STOPPED, (Dictionary<String, Object>)null));
         } catch (final InterruptedException e) {
             this.ignoreException(e);
+            Thread.currentThread().interrupt();
         }
     }
 
@@ -191,8 +192,9 @@ public class TimedEventSender
                 try {
                     event = this.queue.take();
                 } catch (final InterruptedException e) {
-                    // we ignore this
                     this.ignoreException(e);
+                    Thread.currentThread().interrupt();
+                    this.running = false;
                 }
             }
             if ( event != null && this.running ) {
@@ -245,8 +247,9 @@ public class TimedEventSender
                             try {
                                 this.queue.put(event);
                             } catch (final InterruptedException e) {
-                                // this should never happen, so we ignore it
                                 this.ignoreException(e);
+                                Thread.currentThread().interrupt();
+                                this.running = false;
                             }
                         }
                     }
@@ -364,8 +367,9 @@ public class TimedEventSender
                                                 try {
                                                     queue.put(result.event);
                                                 } catch (InterruptedException e) {
-                                                    // we ignore this exception as this should
never occur
                                                     ignoreException(e);
+                                                    Thread.currentThread().interrupt();
+                                                    break;
                                                 }
                                             }
                                         }
@@ -396,6 +400,7 @@ public class TimedEventSender
                         this.queue.put(event);
                     } catch (final InterruptedException ignore) {
                         this.ignoreException(ignore);
+                        Thread.currentThread().interrupt();
                     }
                 }
             }
@@ -493,6 +498,8 @@ public class TimedEventSender
                                 this.queue.put(readResult.event);
                             } catch (final InterruptedException e) {
                                 this.ignoreException(e);
+                                Thread.currentThread().interrupt();
+                                break;
                             }
                         }
                     }



Mime
View raw message