imay commented on a change in pull request #1888: Refactor FrontendHelper
URL: https://github.com/apache/incubator-doris/pull/1888#discussion_r328657189
 
 

 ##########
 File path: be/src/util/frontend_helper.h
 ##########
 @@ -18,33 +18,89 @@
 #pragma once
 
 #include "common/status.h"
+#include <sstream>
+
+#include <boost/foreach.hpp>
+#include <boost/functional/hash.hpp>
+#include <boost/thread/locks.hpp>
+#include <boost/thread/thread.hpp>
+
 #include "gen_cpp/FrontendService_types.h"
+#include "gen_cpp/FrontendService.h"
+#include "runtime/runtime_state.h"
+#include "runtime/exec_env.h"
+#include "runtime/client_cache.h"
+#include "util/network_util.h"
+#include "util/thrift_util.h"
+#include "util/runtime_profile.h"
+#include "runtime/client_cache.h"
 
 namespace doris {
 
+using apache::thrift::protocol::TProtocol;
+using apache::thrift::protocol::TBinaryProtocol;
+using apache::thrift::transport::TSocket;
+using apache::thrift::transport::TTransport;
+using apache::thrift::transport::TBufferedTransport;
+
 class ExecEnv;
 class FrontendServiceClient;
-template <class T> class ClientConnection;
+template <class T> 
+class ClientConnection;
 
 // this class is a helper for jni call. easy for unit test
 class FrontendHelper {
 public:
     static void setup(ExecEnv* exec_env);
 
     // for default timeout
+    template<typename T>
     static Status rpc(
         const std::string& ip,
         const int32_t port,
-        std::function<void (ClientConnection<FrontendServiceClient>&)> 
callback) {
+        std::function<void (ClientConnection<T>&)> callback) {
 
         return rpc(ip, port, callback, config::thrift_rpc_timeout_ms);
     }
 
+    template<typename T>
     static Status rpc(
         const std::string& ip,
         const int32_t port,
-        std::function<void (ClientConnection<FrontendServiceClient>&)> 
callback,
-        int timeout_ms);
+        std::function<void (ClientConnection<T>&)> callback,
 
 Review comment:
   please keep this implementation in cpp file, it will make compile faster.
   You can achieve this by using explicit instantiation. 
   declare this in cpp file
   ```
   template Status rpc<FrontendServiceClient>(const std::string&, const int32_t 
std::function<void (ClientConnection<FrontendServiceClient>&)> callback, int);
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to