-
Bug
-
Resolution: Done
-
Medium
-
None
-
None
The specific code in AbstractCommonSubscriber.java is as follows. When the yang notification is monitored, the websocket message is sent.
/**code**/
synchronized void post(final String data) {
for (final WebSocketSessionHandler subscriber : subscribers) {
final Optional<InetSocketAddress> remoteEndpointAddress = subscriber.getRemoteEndpointAddress();
if (remoteEndpointAddress.isPresent()) {
subscriber.sendDataMessage(data);
LOG.debug("Data was sent to subscriber {} on address {}:", this, remoteEndpointAddress.get());
} else {
// removal is probably not necessary, because it will be removed explicitly soon after invocation of
// onWebSocketClosed(..) in handler; but just to be sure ...
subscribers.remove(subscriber);
LOG.debug("Subscriber for {} was removed - web-socket session is not open.", this);
}
}
}
In the process of traversing the set, delete the element, will cause ConcurrentModificationException.