rymarm commented on a change in pull request #2333: URL: https://github.com/apache/drill/pull/2333#discussion_r734660997
########## File path: exec/rpc/src/main/java/org/apache/drill/exec/rpc/PongListener.java ########## @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.drill.exec.rpc; + +import org.apache.drill.common.exceptions.DrillRuntimeException; +import org.apache.drill.shaded.guava.com.google.common.base.Stopwatch; + +import java.util.EventListener; +import java.util.concurrent.TimeUnit; + +/** + * PongListener realizes the listener pattern. It is used to verify, whether {@link org.apache.drill.exec.rpc.RpcBus.InboundHandler} + * received {@link InboundRpcMessage} with {@link org.apache.drill.exec.proto.GeneralRPCProtos.RpcMode#PONG PONG} mode. + */ +public class PongListener implements EventListener { Review comment: > Suppose someone uses the new JDBC client with an older server that does not support this new handler. What happens? My implementation doesn't break backward compatible because Drill's RPC already handles the ping/pong protocol. My changes only impact the client's behavior. Earlier, RPC [did nothing](https://github.com/apache/drill/blob/0c9451e6720e5028e1187067cc6d1957ff998bef/exec/rpc/src/main/java/org/apache/drill/exec/rpc/RpcBus.java#L321) on PONG answer, but I [add logic](https://github.com/apache/drill/blob/66f3fdebe0a7d8d79052d55968a76301bf5cd673/exec/rpc/src/main/java/org/apache/drill/exec/rpc/RpcBus.java#L323) to notify all who would like to be notified about PONG message (like our [listener](https://github.com/apache/drill/blob/66f3fdebe0a7d8d79052d55968a76301bf5cd673/exec/rpc/src/main/java/org/apache/drill/exec/rpc/BasicClient.java#L341)). > At some point we talked about having a protocol version number in the "hello" message. If that exists, you can check if the server is new enough to handle this message, else skip the active ping from the client. As I said before, even the previous version of the protocol can handle this message. > ...doesn't Drill's RPC already handle the ping/pong protocol? Can we reuse that: just trigger a ping on demand rather than waiting for the next scheduled event? Actually, it does. But it was [implemented](https://github.com/apache/drill/blob/66f3fdebe0a7d8d79052d55968a76301bf5cd673/exec/rpc/src/main/java/org/apache/drill/exec/rpc/BasicClient.java#L196) via netty's idle handler so it can't be called on-demand. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
