Concurrent Modification Exception in Vaadin

Sir ,
In my web application , i have 41 label with icon is set . I updating the label icon in a Thread and i am using Refresher addon to do this.

     I set  the Refresher interval using user  input  in ms . If  user gives below  10ms then the browser said that  [b]

Internal Error please contact your Administrator .
[/b]

     I look into the Server log it  shows that [b]

Concurrent Modification Exception
[/b]is thrown . The following is the Server log

     Jun 15, 2013 10:32:08 AM com.vaadin.Application terminalError
    SEVERE: Terminal error:
    java.util.ConcurrentModificationException
at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
at java.util.ArrayList$Itr.next(Unknown Source)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.getDirtyVisibleComponents(AbstractCommunicationManager.java:2082)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.writeUidlResponce(AbstractCommunicationManager.java:986)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.paintAfterVariableChanges(AbstractCommunicationManager.java:925)
at com.vaadin.terminal.gwt.server.AbstractCommunicationManager.doHandleUidlRequest(AbstractCommunicationManager.java:792)
at com.vaadin.terminal.gwt.server.CommunicationManager.handleUidlRequest(CommunicationManager.java:323)
at com.vaadin.terminal.gwt.server.AbstractApplicationServlet.service(AbstractApplicationServlet.java:501)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:947)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1009)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:312)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

   And i never used Array list in my code .  AbstractCommunicationManager which uses Array List which might cause the Concurrent modifcation Exception.
   What should i do to solve this problem ?

   Please give some suggestion. I have to solve this problem  as soon as possible. 

Thanking you.

Most probably you have a race condition caused by missing synchronization. Whenever you access the application from another thread, you must wrap the access in a
synchronized
block. For instance:

public class MyApp extends Application {
    private Label myLabel = new Label();
    public void init() {
        new Thread() {
            public void run() {
                // do other stuff
                synchronized(MyApp.this) {
                    // here you can safely update the application
                    myLabel.setValue("Updated from thread!");
                }
            }
        }.start();
    }
}

Sir ,
Thank you for your guidance . It was very helpful to me . I synchronized the label setIcon method using Application
instance . Now it’s working very well. Is there any detail given in Book of Vaadin ?

For Vaadin 7 (where the locking is done differently), the book does give more details.

For Vaadin 6, see e.g.
this forum thread
or one of many forum threads, blog posts etc.