aboutsummaryrefslogtreecommitdiffstats
path: root/server/src/com/vaadin
diff options
context:
space:
mode:
authorJohannes Dahlström <johannesd@vaadin.com>2013-10-21 16:16:37 +0300
committerVaadin Code Review <review@vaadin.com>2013-10-22 05:33:16 +0000
commitee809e5985d7a438e031c40bed160ac78ae8d0bc (patch)
tree2c08e2acb086bb12b0936807d253346401ceb02e /server/src/com/vaadin
parent361ad179ebbe5f25e157497394d3d1fb5aaee506 (diff)
downloadvaadin-framework-ee809e5985d7a438e031c40bed160ac78ae8d0bc.tar.gz
vaadin-framework-ee809e5985d7a438e031c40bed160ac78ae8d0bc.zip
Revert broken fix and test (#12446)
The timeoutInterval variable needs to be part of per-UI state for the code to work correctly. Storing it in a servlet-global MetadataWriter instance is both semantically wrong and a race condition. Also, the test currently throws NPE if assertions are enabled. This reverts commit f595d057951523baf35a797692376dfa5de0bc8d. Change-Id: Ia6d1383b2c112b86ce60c75a3ebb9f10da545d4a
Diffstat (limited to 'server/src/com/vaadin')
-rw-r--r--server/src/com/vaadin/server/communication/UidlRequestHandler.java5
-rw-r--r--server/src/com/vaadin/server/communication/UidlWriter.java32
2 files changed, 14 insertions, 23 deletions
diff --git a/server/src/com/vaadin/server/communication/UidlRequestHandler.java b/server/src/com/vaadin/server/communication/UidlRequestHandler.java
index f13199e9ae..d52c5e9fe0 100644
--- a/server/src/com/vaadin/server/communication/UidlRequestHandler.java
+++ b/server/src/com/vaadin/server/communication/UidlRequestHandler.java
@@ -56,7 +56,8 @@ public class UidlRequestHandler extends SynchronizedRequestHandler implements
private ServerRpcHandler rpcHandler = new ServerRpcHandler();
- private UidlWriter uidlWriter = new UidlWriter();
+ public UidlRequestHandler() {
+ }
@Override
public boolean synchronizedHandleRequest(VaadinSession session,
@@ -145,7 +146,7 @@ public class UidlRequestHandler extends SynchronizedRequestHandler implements
JSONException {
openJsonMessage(writer, response);
- uidlWriter.write(ui, writer, repaintAll, false);
+ new UidlWriter().write(ui, writer, repaintAll, false);
closeJsonMessage(writer);
}
diff --git a/server/src/com/vaadin/server/communication/UidlWriter.java b/server/src/com/vaadin/server/communication/UidlWriter.java
index fe7a7d42bf..60933a75c2 100644
--- a/server/src/com/vaadin/server/communication/UidlWriter.java
+++ b/server/src/com/vaadin/server/communication/UidlWriter.java
@@ -51,14 +51,6 @@ import com.vaadin.ui.UI;
*/
public class UidlWriter implements Serializable {
- private LegacyUidlWriter legacyUidlWriter = new LegacyUidlWriter();
- private SharedStateWriter sharedStateWriter = new SharedStateWriter();
- private ConnectorTypeWriter connectorTypeWriter = new ConnectorTypeWriter();
- private ConnectorHierarchyWriter connectorHierarchyWriter = new ConnectorHierarchyWriter();
- private ClientRpcWriter clientRpcWriter = new ClientRpcWriter();
- private MetadataWriter metadataWriter = new MetadataWriter();
- private ResourceWriter resourceWriter = new ResourceWriter();
-
/**
* Writes a JSON object containing all pending changes to the given UI.
*
@@ -87,12 +79,13 @@ public class UidlWriter implements Serializable {
// to write out
session.getService().runPendingAccessTasks(session);
+ ArrayList<ClientConnector> dirtyVisibleConnectors = ui
+ .getConnectorTracker().getDirtyVisibleConnectors();
+ LegacyCommunicationManager manager = session.getCommunicationManager();
// Paints components
+ ConnectorTracker uiConnectorTracker = ui.getConnectorTracker();
getLogger().log(Level.FINE, "* Creating response to client");
- ConnectorTracker uiConnectorTracker = ui.getConnectorTracker();
- ArrayList<ClientConnector> dirtyVisibleConnectors = uiConnectorTracker
- .getDirtyVisibleConnectors();
getLogger().log(
Level.FINE,
"Found " + dirtyVisibleConnectors.size()
@@ -107,13 +100,10 @@ public class UidlWriter implements Serializable {
try {
writer.write("\"changes\" : ");
- LegacyCommunicationManager manager = session
- .getCommunicationManager();
-
JsonPaintTarget paintTarget = new JsonPaintTarget(manager, writer,
!repaintAll);
- legacyUidlWriter.write(ui, writer, paintTarget);
+ new LegacyUidlWriter().write(ui, writer, paintTarget);
paintTarget.close();
writer.write(", "); // close changes
@@ -130,7 +120,7 @@ public class UidlWriter implements Serializable {
// processing.
writer.write("\"state\":");
- sharedStateWriter.write(ui, writer);
+ new SharedStateWriter().write(ui, writer);
writer.write(", "); // close states
// TODO This should be optimized. The type only needs to be
@@ -139,7 +129,7 @@ public class UidlWriter implements Serializable {
// widget mapping
writer.write("\"types\":");
- connectorTypeWriter.write(ui, writer, paintTarget);
+ new ConnectorTypeWriter().write(ui, writer, paintTarget);
writer.write(", "); // close states
// Send update hierarchy information to the client.
@@ -150,7 +140,7 @@ public class UidlWriter implements Serializable {
// child to 0 children)
writer.write("\"hierarchy\":");
- connectorHierarchyWriter.write(ui, writer);
+ new ConnectorHierarchyWriter().write(ui, writer);
writer.write(", "); // close hierarchy
// send server to client RPC calls for components in the UI, in call
@@ -160,7 +150,7 @@ public class UidlWriter implements Serializable {
// which they were performed, remove the calls from components
writer.write("\"rpc\" : ");
- clientRpcWriter.write(ui, writer);
+ new ClientRpcWriter().write(ui, writer);
writer.write(", "); // close rpc
uiConnectorTracker.markAllConnectorsClean();
@@ -170,11 +160,11 @@ public class UidlWriter implements Serializable {
SystemMessages messages = ui.getSession().getService()
.getSystemMessages(ui.getLocale(), null);
// TODO hilightedConnector
- metadataWriter.write(ui, writer, repaintAll, async, messages);
+ new MetadataWriter().write(ui, writer, repaintAll, async, messages);
writer.write(", ");
writer.write("\"resources\" : ");
- resourceWriter.write(ui, writer, paintTarget);
+ new ResourceWriter().write(ui, writer, paintTarget);
Collection<Class<? extends ClientConnector>> usedClientConnectors = paintTarget
.getUsedClientConnectors();