Elek, Marton commented on RATIS-103:

getFollowers() could be called from JMX which uses different thread. I am not 
sure, but IMHO with an unsynchronized list the getFollowers could return with a 
list which could be in an invalid/undeterministic state.

I think it's more safe (but let me know if I am wrong) to use the normal remove 
method of the List interface instead of the remove method on the iterator. 
(Only the iterator.remove is notsupported). Or we can use 
Collections.synchronizedList but it's not as effective as the CopyOnWrite 

> LeaderState.updateSenders may throws UnsupportedOperationException
> ------------------------------------------------------------------
>                 Key: RATIS-103
>                 URL: https://issues.apache.org/jira/browse/RATIS-103
>             Project: Ratis
>          Issue Type: Bug
>            Reporter: Tsz Wo Nicholas Sze
>            Assignee: Tsz Wo Nicholas Sze
>            Priority: Minor
>         Attachments: r103_20170811.patch
> The CopyOnWriteArrayList may not work well in LeaderState since it does not 
> support remove.
> RaftReconfigurationBaseTest.testRemovePeers() fails with 
> UnsupportedOperationException.
> {code}
> Exception in thread "Thread-102" java.lang.UnsupportedOperationException
>         at 
> java.util.concurrent.CopyOnWriteArrayList$COWIterator.remove(CopyOnWriteArrayList.java:1176)
>         at 
> org.apache.ratis.server.impl.LeaderState.updateSenders(LeaderState.java:254)
>         ...
> {code}

This message was sent by Atlassian JIRA

Reply via email to