jsancio commented on code in PR #22505: URL: https://github.com/apache/kafka/pull/22505#discussion_r3431108042
########## raft/src/main/java/org/apache/kafka/raft/internals/ChangeVoterHandlerState.java: ########## @@ -0,0 +1,208 @@ +/* + * 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.kafka.raft.internals; + +import org.apache.kafka.common.protocol.Errors; +import org.apache.kafka.raft.RaftUtil; + +import java.util.Optional; + +/** + * Manages the state of add and remove voter operations. + * <p> + * This class maintains at most one pending voter change operation at a time. Add voter and + * remove voter operations are mutually exclusive - only one type can be in progress at any + * given time. When an operation is reset or expires, its associated future is completed with + * an appropriate error response. + * <p> + * The class also updates the uncommitted voter change metric to reflect whether a voter Review Comment: Yes. But I don't think we need to document that. By default classes are not thread safe. It is classes that are thread safe that need to document their semantic. E.g. ByteArrayInputStream and most Java classes are not thread-safe but they don't document that. Java's API only documents concurrency when the class supports it. -- 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]
