Skip to content

Commit

Permalink
OsgiValidateWorker: Delay announcement of defective Components
Browse files Browse the repository at this point in the history
this hides non-critical errors due to time delay on activate
  • Loading branch information
sfeilmeier committed Nov 10, 2020
1 parent 47cbae5 commit 32ca90a
Showing 1 changed file with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.Stream;
Expand Down Expand Up @@ -57,6 +58,15 @@ public class OsgiValidateWorker extends ComponentManagerWorker {
* Map from Component-ID to defect details.
*/
private final Map<String, String> defectiveComponents = new HashMap<>();

/**
* Delays announcement of defective Components by one execution Cycle.
*/
private final Set<String> lastDefectiveComponents = new HashSet<>();

/**
* Components with duplicated Component-IDs.
*/
private final Set<String> duplicatedComponentIds = new HashSet<String>();

public OsgiValidateWorker(ComponentManagerImpl parent) {
Expand Down Expand Up @@ -84,7 +94,13 @@ protected void forever() {
this.parent._setConfigNotActivated(!defectiveComponents.isEmpty());
synchronized (this.defectiveComponents) {
this.defectiveComponents.clear();
this.defectiveComponents.putAll(defectiveComponents);
for (Entry<String, String> c : defectiveComponents.entrySet()) {
if (this.lastDefectiveComponents.contains(c.getKey())) {
// Delay announcement of defective Components by one execution Cycle.
this.defectiveComponents.put(c.getKey(), c.getValue());
}
}
this.lastDefectiveComponents.addAll(defectiveComponents.keySet());
}
}

Expand Down

0 comments on commit 32ca90a

Please sign in to comment.