Minor cosmetic cleanup in ComponentConfigManager.java
Change-Id: I71c96e2712dd3206e5d7ed52025e649ff1de8d0a
Showing
1 changed file
with
10 additions
and
12 deletions
| ... | @@ -48,8 +48,8 @@ import java.util.Set; | ... | @@ -48,8 +48,8 @@ import java.util.Set; |
| 48 | 48 | ||
| 49 | import static com.google.common.base.Preconditions.checkArgument; | 49 | import static com.google.common.base.Preconditions.checkArgument; |
| 50 | import static com.google.common.base.Preconditions.checkNotNull; | 50 | import static com.google.common.base.Preconditions.checkNotNull; |
| 51 | -import static org.slf4j.LoggerFactory.getLogger; | ||
| 52 | import static org.onosproject.security.AppGuard.checkPermission; | 51 | import static org.onosproject.security.AppGuard.checkPermission; |
| 52 | +import static org.slf4j.LoggerFactory.getLogger; | ||
| 53 | 53 | ||
| 54 | 54 | ||
| 55 | /** | 55 | /** |
| ... | @@ -72,9 +72,7 @@ public class ComponentConfigManager implements ComponentConfigService { | ... | @@ -72,9 +72,7 @@ public class ComponentConfigManager implements ComponentConfigService { |
| 72 | private final Logger log = getLogger(getClass()); | 72 | private final Logger log = getLogger(getClass()); |
| 73 | 73 | ||
| 74 | private final ComponentConfigStoreDelegate delegate = new InternalStoreDelegate(); | 74 | private final ComponentConfigStoreDelegate delegate = new InternalStoreDelegate(); |
| 75 | - //TODO make accumulator properties configurable | 75 | + private final InternalAccumulator accumulator = new InternalAccumulator(); |
| 76 | - private final InternalAccumulator accumulator = new InternalAccumulator(SharedExecutors.getTimer(), | ||
| 77 | - MAX_ITEMS, MAX_BATCH_MILLIS, MAX_IDLE_MILLIS); | ||
| 78 | 76 | ||
| 79 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) | 77 | @Reference(cardinality = ReferenceCardinality.MANDATORY_UNARY) |
| 80 | protected ComponentConfigStore store; | 78 | protected ComponentConfigStore store; |
| ... | @@ -195,19 +193,19 @@ public class ComponentConfigManager implements ComponentConfigService { | ... | @@ -195,19 +193,19 @@ public class ComponentConfigManager implements ComponentConfigService { |
| 195 | } | 193 | } |
| 196 | } | 194 | } |
| 197 | 195 | ||
| 198 | - private class InternalAccumulator extends AbstractAccumulator<String> implements Accumulator<String> { | 196 | + // Buffers multiple subsequent configuration updates into one notification. |
| 197 | + private class InternalAccumulator extends AbstractAccumulator<String> | ||
| 198 | + implements Accumulator<String> { | ||
| 199 | 199 | ||
| 200 | - protected InternalAccumulator(java.util.Timer timer, int maxItems, int maxBatchMillis, int maxIdleMillis) { | 200 | + protected InternalAccumulator() { |
| 201 | - super(timer, maxItems, maxBatchMillis, maxIdleMillis); | 201 | + super(SharedExecutors.getTimer(), MAX_ITEMS, MAX_BATCH_MILLIS, MAX_IDLE_MILLIS); |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | @Override | 204 | @Override |
| 205 | - public void processItems(List items) { | 205 | + public void processItems(List<String> items) { |
| 206 | - //Conversion to hashset removes duplicates | 206 | + // Conversion to set removes duplicates |
| 207 | - Set<String> componentSet = new HashSet<String>(items); | 207 | + Set<String> componentSet = new HashSet<>(items); |
| 208 | componentSet.forEach(ComponentConfigManager.this::triggerUpdate); | 208 | componentSet.forEach(ComponentConfigManager.this::triggerUpdate); |
| 209 | - | ||
| 210 | - | ||
| 211 | } | 209 | } |
| 212 | } | 210 | } |
| 213 | 211 | ... | ... |
-
Please register or login to post a comment