abstractdog commented on code in PR #427:
URL: https://github.com/apache/tez/pull/427#discussion_r2549763920


##########
tez-api/src/main/java/org/apache/tez/client/registry/AMRegistryClient.java:
##########
@@ -0,0 +1,98 @@
+/**
+ * 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.tez.client.registry;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Client-side interface for discovering Application Master (AM) instances
+ * registered in the AM registry.
+ *
+ * <p>Implementations are responsible for locating AM endpoints and returning
+ * their metadata. This API is used by client components to discover running
+ * Tez AMs.</p>
+ *
+ * <p>Listeners may be registered to receive notifications when AM records
+ * appear or are removed.</p>
+ */
+public abstract class AMRegistryClient implements Closeable {
+
+  private final List<AMRegistryClientListener> listeners = new ArrayList<>();
+
+  /**
+   * Returns the current set of registered listeners.
+   *
+   * @return a mutable list of listeners
+   */
+  protected List<AMRegistryClientListener> getListeners() {
+    return listeners;
+  }
+
+  /**
+   * Lookup AM metadata for the given application ID.
+   *
+   * @param appId the application ID
+   * @return the AM record if found, otherwise {@code null}
+   * @throws IOException if the lookup fails
+   */
+  public abstract AMRecord getRecord(String appId) throws IOException;

Review Comment:
   yeah, also, as ApplicationId's equals and hashCode are properly implemented, 
we can use it as the Map key type also
   ```
     private final ConcurrentHashMap<ApplicationId, AMRecord> amRecordCache = 
new ConcurrentHashMap<>();
   ```



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

Reply via email to