diff --git a/activemq-ra/src/test/java/org/apache/activemq/ra/ConnectionManagerAdapter.java b/activemq-ra/src/test/java/org/apache/activemq/ra/ConnectionManagerAdapter.java index 2d5d83ce80b..bccf4802001 100644 --- a/activemq-ra/src/test/java/org/apache/activemq/ra/ConnectionManagerAdapter.java +++ b/activemq-ra/src/test/java/org/apache/activemq/ra/ConnectionManagerAdapter.java @@ -17,7 +17,6 @@ package org.apache.activemq.ra; import java.util.ArrayList; -import java.util.Iterator; import jakarta.resource.ResourceException; import jakarta.resource.spi.ConnectionEvent; @@ -50,8 +49,7 @@ public class ConnectionManagerAdapter implements ConnectionManager, ConnectionEv * @param l */ public void addConnectionEventListener(ConnectionEventListener l) { - for (Iterator iter = connections.iterator(); iter.hasNext();) { - ManagedConnection c = iter.next(); + for (ManagedConnection c : connections) { c.addConnectionEventListener(l); } listners.add(l); @@ -66,8 +64,7 @@ public Object allocateConnection(ManagedConnectionFactory connectionFactory, Con Subject subject = null; ManagedConnection connection = connectionFactory.createManagedConnection(subject, info); connection.addConnectionEventListener(this); - for (Iterator iter = listners.iterator(); iter.hasNext();) { - ConnectionEventListener l = iter.next(); + for (ConnectionEventListener l : listners) { connection.addConnectionEventListener(l); } connections.add(connection);