Author: cziegeler Date: Fri Dec 1 09:01:15 2017 New Revision: 1816813 URL: http://svn.apache.org/viewvc?rev=1816813&view=rev Log: Update change count handling
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=1816813&r1=1816812&r2=1816813&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 Fri Dec 1 09:01:15 2017 @@ -131,23 +131,22 @@ public final class HttpServiceRuntimeImp { if ( reg != null ) { - boolean setProps = false; - final long count; + boolean setPropsDirectly = false; synchronized ( this ) { this.changeCount++; - count = this.changeCount; + final long count = this.changeCount; this.setAttribute(PROP_CHANGECOUNT, this.changeCount); - if ( this.updateChangeCountDelay > 0 && this.timer == null ) + if ( this.updateChangeCountDelay <= 0L ) { - this.timer = new Timer(); - } - if ( this.updateChangeCountDelay == 0L ) - { - setProps = true; + setPropsDirectly = true; } else { + if ( this.timer == null ) + { + this.timer = new Timer(); + } timer.schedule(new TimerTask() { @@ -174,8 +173,16 @@ public final class HttpServiceRuntimeImp }, this.updateChangeCountDelay); } } - if ( setProps ) { - reg.setProperties(getAttributes()); + if ( setPropsDirectly ) + { + try + { + reg.setProperties(getAttributes()); + } + catch ( final IllegalStateException ise) + { + // we ignore this as this might happen on shutdown + } } } }