neils-dev commented on a change in pull request #2901:
URL: https://github.com/apache/ozone/pull/2901#discussion_r789288665



##########
File path: 
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/GrpcOmTransport.java
##########
@@ -70,42 +77,71 @@
   private final AtomicBoolean isRunning = new AtomicBoolean(false);
 
   // gRPC specific
-  private ManagedChannel channel;
-
   private OzoneManagerServiceGrpc.OzoneManagerServiceBlockingStub client;
+  private Map<String,
+      OzoneManagerServiceGrpc.OzoneManagerServiceBlockingStub> clients;
+  private Map<String, ManagedChannel> channels;
+  private int lastVisited = -1;
+  private ConfigurationSource conf;
 
   private String host = "om";
-  private int port = 8981;
   private int maxSize;
 
+  private List<String> oms;
+  private RetryPolicy retryPolicy;
+  private int failoverCount = 0;
+  private GrpcOMFailoverProxyProvider omFailoverProxyProvider;
+
   public GrpcOmTransport(ConfigurationSource conf,
                           UserGroupInformation ugi, String omServiceId)
       throws IOException {
-    Optional<String> omHost = getHostNameFromConfigKeys(conf,
-        OZONE_OM_ADDRESS_KEY);
-    this.host = omHost.orElse("0.0.0.0");
 
-    port = conf.getObject(GrpcOmTransportConfig.class).getPort();
+    this.channels = new HashMap<>();
+    this.clients = new HashMap<>();
+    this.conf = conf;
 
     maxSize = conf.getInt(OZONE_OM_GRPC_MAXIMUM_RESPONSE_LENGTH,
         OZONE_OM_GRPC_MAXIMUM_RESPONSE_LENGTH_DEFAULT);
 
+    omFailoverProxyProvider = new GrpcOMFailoverProxyProvider(
+        conf,
+        ugi,
+        omServiceId,
+        OzoneManagerProtocolPB.class);
+
     start();
   }
 
-  public void start() {
+  public void start() throws IOException {
     if (!isRunning.compareAndSet(false, true)) {

Review comment:
       Changed setting of `isRunning` to return immediately if set 
(`isRunning`==true).  Sets boolean variable _only_ after the address lookup on 
method exit.




-- 
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]



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

Reply via email to