Thomas Broyer has posted comments on this change.

Change subject: Proxy IDs have to be the same for a given proxy in the response payload.
......................................................................


Patch Set 2:

The problem is that we have 2 ways of identifying an object: using it's proxy type in both case and either a client ID or server ID.

The client ID is scoped to a RequestContext and only used for a) EntityProxies created on the client-side (known as ephemeral ID), b) ValueProxies wherever they come from (ValueProxies don't have IDs, we're synthetizing ones for cross-reference in the request/response payload). For EntityProxies originating from the server, only the server ID is ever used (aka persistent ID).

When persisting an EntityProxy created on the client on the server, it's then given a server ID (transitions from ephemeral to persistent ID, and now has both client –so it can be matched back to the proxy on the client-side– and server –so it can be referenced in subsequent requests– IDs).

Now to our problem: the SimpleProxyId's hashCode is based on whether it has a client ID or not: if it has one, it's used as the hashCode, otherwise the serverId's hashCode is used. So, when we receive {"T":"type", "S":"serverId", "C":1} and {"T":"type", "S":"serverId"}, they're conceptually identical, but technically have different hashCodes. Because the SimpleProxyId is used as a key to the proxy in a map, those 2 IDs in the same response would map to different proxies (so one of them won't ever be populated; and because proxies are lazily created, but "finalized" only based on a specific list, one of those proxies won't be "finalized" either, and will generate a "don't cross the streams" exception when used in another RequestContext).

This patch makes sure we'd always use {"T":"type, "S":"serverId", "C":1} everywhere in the response payload.

BTW, SimpleProxyId#equals violates the contract, as it's not symmetric. This is another problem that we hopefully never run into.

--
To view, visit https://gwt-review.googlesource.com/1770
To unsubscribe, visit https://gwt-review.googlesource.com/settings

Gerrit-MessageType: comment
Gerrit-Change-Id: I6c2ccbcfc67323e9e5cae214b0d101ddfc1a2298
Gerrit-PatchSet: 2
Gerrit-Project: gwt
Gerrit-Branch: master
Gerrit-Owner: Thomas Broyer <[email protected]>
Gerrit-Reviewer: Matthew Dempsky <[email protected]>
Gerrit-Reviewer: Thomas Broyer <[email protected]>
Gerrit-HasComments: No

--
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors
--- You received this message because you are subscribed to the Google Groups "Google Web Toolkit Contributors" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to