Uploaded image for project: 'netconf'
  1. netconf
  2. NETCONF-664

The ConcurrentModificationException was found in the websocket test in restconf-nb-rfc8040.

XMLWordPrintable

      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.

            wsx25289 wang senxiao
            wsx25289 wang senxiao
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: