matthiasblaesing commented on code in PR #6872:
URL: https://github.com/apache/netbeans/pull/6872#discussion_r1443768840


##########
enterprise/javaee.wildfly/src/org/netbeans/modules/javaee/wildfly/ide/ui/AddServerLocationPanel.java:
##########
@@ -44,25 +42,15 @@ public class AddServerLocationPanel implements 
WizardDescriptor.FinishablePanel,
 
     private AddServerLocationVisualPanel component;
     private WizardDescriptor wizard;
-    private final transient Set listeners = ConcurrentHashMap.newKeySet(2);
+    private final transient Set<ChangeListener> listeners = 
ConcurrentHashMap.newKeySet(2);
 
     public AddServerLocationPanel(WildflyInstantiatingIterator 
instantiatingIterator) {
         this.instantiatingIterator = instantiatingIterator;
     }
 
     @Override
     public void stateChanged(ChangeEvent ev) {
-        fireChangeEvent(ev);
-    }
-
-    private void fireChangeEvent(ChangeEvent ev) {
-        Iterator it;
-        synchronized (listeners) {
-            it = new HashSet(listeners).iterator();
-        }
-        while (it.hasNext()) {
-            ((ChangeListener) it.next()).stateChanged(ev);
-        }
+        listeners.iterator().forEachRemaining(l -> l.stateChanged(ev));

Review Comment:
   Behavior is now back to the original "Make a copy of the listener list and 
then fire"-methology, the code is more compact and there is no useless 
synchronization. I intent to merge tomorrow.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to