abstractdog commented on code in PR #427: URL: https://github.com/apache/tez/pull/427#discussion_r2549694323
########## tez-api/src/main/java/org/apache/tez/client/registry/AMRegistry.java: ########## @@ -0,0 +1,104 @@ +/** + * 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.util.ArrayList; +import java.util.List; + +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.service.AbstractService; +import org.apache.hadoop.service.ServiceStateException; +import org.apache.hadoop.yarn.api.records.ApplicationId; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Base class for {@code AMRegistry} implementations. + * + * <p>The specific implementation is configured via the + * {@code tez.am.registry.class} property.</p> + * + * <p>Implementations are expected to provide appropriate service lifecycle + * behavior, including: + * <ul> + * <li>{@code init}</li> + * <li>{@code serviceStart}</li> + * <li>{@code serviceStop}</li> + * </ul> + * </p> + * + * <p>{@code init} and {@code serviceStart} are invoked during + * {@code DAGAppMaster.serviceInit()}, while {@code serviceStop} is called + * when {@code DAGAppMaster} shuts down.</p> + */ +public abstract class AMRegistry extends AbstractService { + + private static final Logger LOG = LoggerFactory.getLogger(AMRegistry.class); + private List<AMRecord> amRecords = new ArrayList<>(); Review Comment: also, there is a private amRecords in the ZkAMRegistry subclass, which makes it really confusing, let me cleanup this codepath EDIT: moving the collection to the subclass, making a final, synchronized collection -- 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]
