reta commented on code in PR #3475:
URL: https://github.com/apache/cxf/pull/3475#discussion_r4025367629
##########
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:
thanks @coheigea , yeah the clone is ugly, but there is an important
difference: `clone` returns returns a shallow copy of this list. (The elements
themselves are not copied). With array, we actually allocate and copy all
elements into a new array.
--
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]