Exception in thread “Thread-18” java.lang.IllegalStateException: A connector should not be marked as dirty while a response is being written.
at com.vaadin.ui.ConnectorTracker.markDirty(ConnectorTracker.java:346)
at com.vaadin.server.AbstractClientConnector.markAsDirty(AbstractClientConnector.java:139)
at com.vaadin.server.AbstractClientConnector.requestRepaint(AbstractClientConnector.java:131)
at com.vaadin.server.AbstractClientConnector.addMethodInvocationToQueue(AbstractClientConnector.java:393)
at com.vaadin.server.AbstractClientConnector$RpcInvocationHandler.invoke(AbstractClientConnector.java:369)
at com.sun.proxy.$Proxy7.updatePointValue(Unknown Source)
at com.vaadin.addon.charts.Chart$1.dataUpdated(Chart.java:395)
at com.vaadin.addon.charts.model.Configuration.fireDataUpdated(Configuration.java:594)
at com.vaadin.addon.charts.model.ListSeries.updatePoint(ListSeries.java:149)
Hi,
Check out this thread:
https://vaadin.com/forum#!/thread/1820683
In short, if you are having some threads processing in the background, you should follow this process:
component.getUI().getSession().getLock().lock();
try {
doStuffWith(component);
} finally {
component.getUI().getSession().getLock().unlock();
}
Hi All,
Am using Pagetable addon with vaadin 7.Am getting this exception frequently when user clicks inside the table multiple times.
java.lang.IllegalStateException: A connector should not be marked as dirty while a response is being written.
at com.vaadin.ui.ConnectorTracker.markDirty(ConnectorTracker.java:346)
at com.vaadin.server.AbstractClientConnector.markAsDirty(AbstractClientConnector.java:139)
at com.vaadin.server.AbstractClientConnector.attach(AbstractClientConnector.java:597)
at com.vaadin.ui.AbstractComponent.attach(AbstractComponent.java:554)
at com.vaadin.server.AbstractClientConnector.setParent(AbstractClientConnector.java:586)
at com.vaadin.ui.AbstractComponent.setParent(AbstractComponent.java:457)
at com.vaadin.ui.Table.registerComponent(Table.java:2350)
at com.vaadin.ui.Table.parseItemIdToCells(Table.java:2337)
at com.vaadin.ui.Table.getVisibleCellsNoCache(Table.java:2147)
at com.vaadin.ui.Table.refreshRenderedCells(Table.java:1668)
at com.vaadin.ui.Table.refreshRowCache(Table.java:2613)
at com.vaadin.ui.Table.setPageLength(Table.java:1027)
at com.jensjansson.pagedtable.PagedTable.getPageLength(PagedTable.java:65)
at com.vaadin.ui.Table.paintTableAttributes(Table.java:3421)
at com.vaadin.ui.Table.paintContent(Table.java:3183)
Can anyone help me on this
Can any one could help me in resolving this issue?
At first sight this seems like a bug in the PagedTable add-on. However, I can’t find a getPageLength method at line 65 of PagedTable.java as your stack trace indicates. So which version of Vaadin and the PagedTable add-on are you using?
At first sight this seems like a bug in the PagedTable add-on. However, I can’t find a getPageLength method at line 65 of PagedTable.java as your stack trace indicates. So which version of Vaadin and the PagedTable add-on are you using
Hi,
Am using vaadin 7.0.5 and i have customized the pagedtable code.I have atttached the code as well
13361.java (14.4 KB)
13362.java (5.22 KB)
Hi,
looking at the code it seems that your getPageLenght method ends up calling setPageLenght too. This will invalidate caches in the Table, causing it to need to rerender (essentially the shared state will be dirty) but it’s not allowed at this point anymore.
If possible, rework the logic. If you need to set the page lenght you should do it earlier. You might want to look into overriding the beforeClientResponse method, you might be able to do this there.
Hi,
looking at the code it seems that your getPageLenght method ends up calling setPageLenght too. This will invalidate caches in the Table, causing it to need to rerender (essentially the shared state will be dirty) but it’s not allowed at this point anymore.
If possible, rework the logic. If you need to set the page lenght you should do it earlier. You might want to look into overriding the beforeClientResponse method, you might be able to do this there.
HI Teppo,
Thank you for your respone…
I have explicilty set the Table’s pagelength in PageTable class otherwise Table takes its default pagelength as 7.
@Override
public int getPageLength(){
int pageLength=0;
if(container!=null && container.getPageLength()>0){
pageLength=container.getPageLength();
/*VaadinSession.getCurrent().lock();
try {
super.setPageLength(pageLength);
} finally {
VaadinSession.getCurrent().unlock();
}*/
}else{
pageLength=super.getPageLength();
}
setPageLength(pageLength);
return pageLength;
}
that is the reason,i called setPageLength(pageLength).
Could you please explain me more in detail
“If possible, rework the logic. If you need to set the page lenght you should do it earlier. You might want to look into overriding the beforeClientResponse method, you might be able to do this there.”
Thanks,
Prabha M.
Hi,
I can’t help you since I don’t exactly understand your modifications and what you’re trying to do. For the page length issue you mention, the PagedTable already has overridden the setPageLength method which should handle this:
@Override
public void setPageLength(int pageLength) {
if (pageLength >= 0 && getPageLength() != pageLength) {
container.setPageLength(pageLength);
super.setPageLength(pageLength);
firePagedChangedEvent();
}
}
But you have removed this method completely, why?
Anyway, the bottom line is, you
can not
call setPageLength from getPageLength! It’s against contract in vaadin (hence the exception) and will not work. You must find another way to do this. Why does not the default way used by PagedTable work for you? It should keep the Table’s and container’s page lengths in sync.