| Summary: | AnnotationProcessing for "on navigation node events" adds listeners multiple times | ||
|---|---|---|---|
| Product: | [RT] Riena | Reporter: | Stefan Liebig <Stefan.Liebig> |
| Component: | navigation | Assignee: | Stefan Liebig <Stefan.Liebig> |
| Status: | RESOLVED FIXED | QA Contact: | |
| Severity: | normal | ||
| Priority: | P2 | CC: | christian.campo |
| Version: | 3.0.0 | ||
| Target Milestone: | 3.0.0 | ||
| Hardware: | PC | ||
| OS: | Windows 7 | ||
| Whiteboard: | |||
|
Description
Stefan Liebig
+1 for solution 1 (Sounds easier with less risk) yes, 1. is simpler but 2. is more general since it protects itself instead of relying on someone else to do that.
And, I think this:
+ private final Map<INavigationNodeController, ?> alreadyProcessed = new WeakHashMap<INavigationNodeController, Object>();
private NavigationNodeControllerAnnotationProcessor() {
// singleton
}
/**
* Process the {@link OnNavigationNodeEvent} annotations for the given
* {@link INavigationNodeController}.
*
* @param navigationNodeController
* the {@link INavigationNodeController} to process
*/
public void processAnnotations(final INavigationNodeController navigationNodeController) {
+ synchronized (alreadyProcessed) {
+ if (alreadyProcessed.containsKey(navigationNodeController)) {
+ return;
+ }
+ alreadyProcessed.put(navigationNodeController, null);
+ }
processAnnotations(navigationNodeController, navigationNodeController.getClass());
}
is also quite simple. New code lines marked with +
Fixed with solution 2. |