You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by cz...@apache.org on 2017/11/30 08:52:03 UTC

svn commit: r1816692 - /felix/trunk/osgi-r7/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceRuntimeImpl.java

Author: cziegeler
Date: Thu Nov 30 08:52:03 2017
New Revision: 1816692

URL: http://svn.apache.org/viewvc?rev=1816692&view=rev
Log:
Fix synchronization issue

Modified:
    felix/trunk/osgi-r7/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceRuntimeImpl.java

Modified: felix/trunk/osgi-r7/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceRuntimeImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/osgi-r7/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceRuntimeImpl.java?rev=1816692&r1=1816691&r2=1816692&view=diff
==============================================================================
--- felix/trunk/osgi-r7/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceRuntimeImpl.java (original)
+++ felix/trunk/osgi-r7/http/base/src/main/java/org/apache/felix/http/base/internal/service/HttpServiceRuntimeImpl.java Thu Nov 30 08:52:03 2017
@@ -131,6 +131,7 @@ public final class HttpServiceRuntimeImp
     {
         if ( reg != null )
         {
+            boolean setProps = false;
             final long count;
             synchronized ( this )
             {
@@ -141,38 +142,41 @@ public final class HttpServiceRuntimeImp
                 {
                     this.timer = new Timer();
                 }
+                if ( this.updateChangeCountDelay == 0L )
+                {
+                    setProps = true;
+                }
+                else
+                {
+                    timer.schedule(new TimerTask()
+                    {
+
+                        @Override
+                        public void run()
+                        {
+                            synchronized ( HttpServiceRuntimeImpl.this )
+                            {
+                                if ( changeCount == count )
+                                {
+                                    try
+                                    {
+                                        reg.setProperties(getAttributes());
+                                    }
+                                    catch ( final IllegalStateException ise)
+                                    {
+                                        // we ignore this as this might happen on shutdown
+                                    }
+                                    timer.cancel();
+                                    timer = null;
+                                }
+                            }
+                        }
+                    }, this.updateChangeCountDelay);
+                }
             }
-            if ( this.updateChangeCountDelay == 0L )
-            {
+            if ( setProps ) {
                 reg.setProperties(getAttributes());
             }
-            else
-            {
-	            timer.schedule(new TimerTask()
-	            {
-
-	                @Override
-	                public void run()
-	                {
-	                    synchronized ( HttpServiceRuntimeImpl.this )
-	                    {
-	                        if ( changeCount == count )
-	                        {
-	                            try
-	                            {
-	                                reg.setProperties(getAttributes());
-	                            }
-	                            catch ( final IllegalStateException ise)
-	                            {
-	                                // we ignore this as this might happen on shutdown
-	                            }
-	                            timer.cancel();
-	                            timer = null;
-	                        }
-	                    }
-	                }
-	            }, this.updateChangeCountDelay);
-            }
         }
     }
 }