We should update the RPC specification to note that if the empty string is passed as the message name during a handshake negotiation then it should be ignored. Or we might say that an empty message name is always to be ignored, to permit ping messages in any protocol at any time.
I think that both of these sound like good solutions. Either way an RPC with an empty name should be considered reserved for internal use by Avro.
The change to Responder might also check !wasConnected, unless we decide that pings are desired.
Makes sense. I've been thinking about the question of whether pings should be a core part of the protocol, and it doesn't seem like they would be useful in the general case. Can you think of a use case for pings that the majority of users would want/need? I suppose that one use case might be a type of pessimistic connection management scheme in which we ping the server periodically to make sure the connection is alive before we attempt an RPC. However, there is nothing to prevent the connection from terminating between the ping and the RPC, so even in this case the client would have to support an optimistic connection management policy in which the connection is assumed to be alive until a failure occurs, at which time the connection would have to be reestablished. The only other use case I can think of right now would be measuring client-server latency. Now this might be useful, and we could consider adding a method in Responder to give some kind of estimate of client-server latency by using pings.
What's the advantage of passing a boolean to the Requestor constructor to calling a method like getRemote()? We might instead add a new method ensureHandshake() or somesuch that does nothing but call getRemote().
I suppose there is no real advantage to having this flag in the constructor, other than possibly making it more obvious to users who are more likely to look at the JavaDoc of the constructor than all of the other methods in the class. If we decide that we want to include pings as a general feature of Avro protocols, I suppose we could simply have a method called ping() or ensureHandshake() or measureLantency() that would establish this handshake if necessary.
Why doesn't SpecificRequestor#getClient() just pass performHandshake to the requestor constructor, so the only call to getRemote() is in the base Requestor class, avoiding the duplication of that logic?
Good catch. It should be changed as you suggested.
So I guess the next steps are:
- Decide whether to change the RPC spec to make an empty message name reserved for use by Avro and to specify what should happen when a server receives a request with an empty message name
- Decide whether pings should be supported
- Make the suggested changes to the patch