Serialize the request early so that developers find out as soon as possible if

they're fucking up. Also fixed up a comment.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6135 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2010-08-27 23:02:23 +00:00
parent d99d17ca7a
commit 9bdf1f8ef1
@@ -485,7 +485,10 @@ public abstract class PeerManager
return; return;
} }
// build a set of node names (including the local node) to // serialize the action to make sure we can
byte[] requestBytes = flattenRequest(request);
// build a set of node names (including the local node) to which to send the request
final Set<String> nodes = Sets.newHashSet(); final Set<String> nodes = Sets.newHashSet();
if (request.isApplicable(_nodeobj)) { if (request.isApplicable(_nodeobj)) {
nodes.add(_nodeobj.nodeName); nodes.add(_nodeobj.nodeName);
@@ -495,15 +498,11 @@ public abstract class PeerManager
nodes.add(peer.getNodeName()); nodes.add(peer.getNodeName());
} }
} }
if (nodes.isEmpty() && onDropped != null) { if (nodes.isEmpty() && onDropped != null) {
onDropped.run(); onDropped.run();
return; return;
} }
// serialize the action to make sure we can
byte[] requestBytes = flattenRequest(request);
for (final String node : nodes) { for (final String node : nodes) {
invokeNodeRequest(node, requestBytes, new InvocationService.ResultListener() { invokeNodeRequest(node, requestBytes, new InvocationService.ResultListener() {
public void requestProcessed (Object result) { public void requestProcessed (Object result) {