Table refresh in synchronized block?

Hi to all,
my Vaadin App is accessed by 30 user concurrently which write data, read and other using Table and SqlContainer.

It runs on Tomcat 7.0.27 with JVM 1.6 u24 and sometimes, typically unders stress, the application server use lots of CPU and some Threads looks like to be in “BLOCKED” state.

This thread end its stackTrace with…

 java.util.HashMap.getEntry ( 

I not use synchronized ( … ) block in my app because I thought they can create problem, but in the forum I’ve read some discussions that say the countrary.

  • What should I do in my multi-user app when I refresh data on Table with SqlContainer?
  • Should or should not use synchronized blocks?
  • What can cause this blocked thread?

P.S. Sometimes the blocked thread is the AbstractCommunicationManager at 747 line.

Thanks, Stefano

Additional info: in these table I use GeneratedColomn that get a Button with an Image; this Image is a static variable in a class that I use to load Image from my Theme.

Can this create problem?

Before crash, on catalina.out i see this

The crash was caused by a for (…) which never end.

But my question about synchronized block remains without answer. No-one know that?

Thanks, Stefano

Well 30 users in an application mean 30 separate threads - but they are all working on distinct objects and should not share any data (except you are doing some dirty things like using static). Synchronized-blocks are only necessary if data - or more precisly object-state - is shared across threads. This doesn’t happen in a typical Vaadin-application, so you normally should not need to use synchronized.

For the shared data on your database you don’t need to synchronize yourself, that must be done by the DBMS (configurable over Isolation-Levels).