> When I use the syntax from the samples in the onTextMessage() method, I get
> ConcurrentModificationException if I have more than one client sending data
> to the server at the same time:
>
>             for(MyMessageInbound mmib: mmiList){
>                 CharBuffer buffer = CharBuffer.wrap(cb);
>                 mmib.myoutbound.writeTextMessage(buffer);
>                 mmib.myoutbound.flush();
>             }
>
>
> Changing it to the following works fine:
>
>             for(int i = 0; i < mmib.size(); i++) {
>                 MyMessageInbound mmib = mmiList.get(i);
>                 CharBuffer buffer = CharBuffer.wrap(cb);
>                 mmib.myoutbound.writeTextMessage(buffer);
>                 mmib.myoutbound.flush();
>             }
>
> However, this approach is not as efficient as to use an Iterator, unless I
> clone the mmiList Collection to iterate over it...

Can you explain where is the in-efficiency?

Thanks

Chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to