Author: pauls
Date: Fri Feb 22 22:40:16 2019
New Revision: 1854178

URL: http://svn.apache.org/viewvc?rev=1854178&view=rev
Log:
FELIX-6067: Make sure getService isn't failing if thread is interrupted.

Modified:
    
felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java

Modified: 
felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
URL: 
http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java?rev=1854178&r1=1854177&r2=1854178&view=diff
==============================================================================
--- 
felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
 (original)
+++ 
felix/trunk/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
 Fri Feb 22 22:40:16 2019
@@ -358,16 +358,27 @@ public class ServiceRegistry
                             holder = usage.m_svcHolderRef.get();
                             if (holder != null)
                             {
-                                try
+                                boolean interrupted = false;
+                                do
                                 {
-                                    // Need to ensure that the other thread 
has obtained
-                                    // the service.
-                                    holder.m_latch.await();
-                                }
-                                catch (InterruptedException e)
-                                {
-                                    throw new RuntimeException(e);
+                                    try
+                                    {
+                                        // Need to ensure that the other 
thread has obtained
+                                        // the service.
+                                        holder.m_latch.await();
+                                        if (interrupted)
+                                        {
+                                            Thread.currentThread().interrupt();
+                                        }
+                                        interrupted = false;
+                                    }
+                                    catch (InterruptedException e)
+                                    {
+                                        interrupted = true;
+                                        Thread.interrupted();
+                                    }
                                 }
+                                while (interrupted);
                                 svcObj = holder.m_service;
                             }
                         }


Reply via email to