Author: tjwatson
Date: Tue Jun 20 20:21:36 2017
New Revision: 1799366
URL: http://svn.apache.org/viewvc?rev=1799366&view=rev
Log:
FELIX-5416 - Endless loop throwing InterruptedException when shutting down
framework
Modified:
felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java
Modified:
felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java
URL:
http://svn.apache.org/viewvc/felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java?rev=1799366&r1=1799365&r2=1799366&view=diff
==============================================================================
---
felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java
(original)
+++
felix/trunk/osgi-r7/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java
Tue Jun 20 20:21:36 2017
@@ -75,15 +75,23 @@ class ComponentActorThread implements Ru
{
while ( tasks.isEmpty() )
{
+ boolean interrupted = Thread.interrupted();
try
{
tasks.wait();
}
catch ( InterruptedException ie )
{
- Thread.currentThread().interrupt();
+ interrupted = true;
// don't care
}
+ finally
+ {
+ if (interrupted)
+ { // restore interrupt status
+ Thread.currentThread().interrupt();
+ }
+ }
}
task = tasks.removeFirst();
@@ -126,14 +134,23 @@ class ComponentActorThread implements Ru
{
while ( !tasks.isEmpty() )
{
+ boolean interrupted = Thread.interrupted();
try
{
tasks.wait();
}
catch ( InterruptedException e )
{
- Thread.currentThread().interrupt();
- logger.log( LogService.LOG_ERROR, "Interrupted exception
waiting for queue to empty", e );
+ interrupted = true;
+ logger.log(LogService.LOG_ERROR,
+ "Interrupted exception waiting for queue to empty", e);
+ }
+ finally
+ {
+ if (interrupted)
+ { // restore interrupt status
+ Thread.currentThread().interrupt();
+ }
}
}
}
Modified:
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java
URL:
http://svn.apache.org/viewvc/felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java?rev=1799366&r1=1799365&r2=1799366&view=diff
==============================================================================
---
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java
(original)
+++
felix/trunk/scr/src/main/java/org/apache/felix/scr/impl/ComponentActorThread.java
Tue Jun 20 20:21:36 2017
@@ -75,15 +75,23 @@ class ComponentActorThread implements Ru
{
while ( tasks.isEmpty() )
{
+ boolean interrupted = Thread.interrupted();
try
{
tasks.wait();
}
catch ( InterruptedException ie )
{
- Thread.currentThread().interrupt();
+ interrupted = true;
// don't care
}
+ finally
+ {
+ if (interrupted)
+ { // restore interrupt status
+ Thread.currentThread().interrupt();
+ }
+ }
}
task = tasks.removeFirst();
@@ -126,14 +134,23 @@ class ComponentActorThread implements Ru
{
while ( !tasks.isEmpty() )
{
+ boolean interrupted = Thread.interrupted();
try
{
tasks.wait();
}
catch ( InterruptedException e )
{
- Thread.currentThread().interrupt();
- logger.log( LogService.LOG_ERROR, "Interrupted exception
waiting for queue to empty", e );
+ interrupted = true;
+ logger.log(LogService.LOG_ERROR,
+ "Interrupted exception waiting for queue to empty", e);
+ }
+ finally
+ {
+ if (interrupted)
+ { // restore interrupt status
+ Thread.currentThread().interrupt();
+ }
}
}
}