PDA

View Full Version : [FNR] BaseModel Concurrency problem



gammagec
17 Nov 2010, 5:46 PM
As I mentioned at the meeting at Sencha Conference, I had found an issue with Concurrency exceptions
while using BaseModel implementation in Gxt 2.0.1

To fix it, I extended the ChangeEventSupport class


import com.extjs.gxt.ui.client.data.ChangeEvent;
import com.extjs.gxt.ui.client.data.ChangeEventSupport;
import com.extjs.gxt.ui.client.data.ChangeListener;

/**
* Wrapper for GXT's ChangeEventSupport.
* <p>
* Fixes Concurrent MOdification errors that occur otherwise.
* </p>
*
* @author cgammage@bioimagene.com
* @since May 3, 2010
*/
public class ConcurrentChangeEventSupport extends ChangeEventSupport {

@Override
public final void notify(final ChangeEvent event) {
if (!silent && listeners != null) {
final ChangeListener[] l =
listeners.toArray(new ChangeListener[listeners.size()]);

for (final ChangeListener listener : l) {
listener.modelChanged(event);
}
}
}
}

and
copied BaseModel to use


/**
* Default Constructor.
* <p>
* Create a new instance of BaseModel.
* </p>
*/
public BaseModel() {
changeEventSupport = new ConcurrentChangeEventSupport();
}

These errors were only occurring in hosted mode, and we are using GWT 1.7

sven
17 Nov 2010, 8:04 PM
Thanks. I fixed it locally already. I cannot access SVN from the hotel, i will commit it as soon as i am back in germany again.

sven
22 Nov 2010, 3:44 AM
Fixed in SVN as of revision 2333

gammagec
22 Nov 2010, 11:44 AM
Thanks sven!