coheigea commented on code in PR #3475:
URL: https://github.com/apache/cxf/pull/3475#discussion_r4022721087
##########
core/src/main/java/org/apache/cxf/bus/managers/ServerLifeCycleManagerImpl.java:
##########
@@ -63,7 +63,10 @@ public void startServer(Server server) {
}
public void stopServer(Server server) {
- ListIterator<ServerLifeCycleListener> li =
listeners.listIterator(listeners.size());
+ @SuppressWarnings("unchecked")
+ final CopyOnWriteArrayList<ServerLifeCycleListener> cloned =
+ (CopyOnWriteArrayList<ServerLifeCycleListener>) listeners.clone();
+ ListIterator<ServerLifeCycleListener> li =
cloned.listIterator(cloned.size());
while (li.hasPrevious()) {
li.previous().stopServer(server);
}
Review Comment:
@reta Claude suggests this instead as it doesn't require the checkstyle
suppresswarnings and doesn't constrain the field type:
```
final ServerLifeCycleListener[] snapshot = listeners.toArray(new
ServerLifeCycleListener[0]);
for (int i = snapshot.length - 1; i >= 0; i--) {
snapshot[i].stopServer(server);
}
```
--
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]