Hangleton commented on code in PR #13558: URL: https://github.com/apache/kafka/pull/13558#discussion_r1197911485
########## core/src/test/java/kafka/zk/ReceiptEvent.java: ########## @@ -0,0 +1,100 @@ +/* + * 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 kafka.zk; + +import org.apache.zookeeper.server.MutedServerCxn; +import org.apache.zookeeper.server.Request; +import org.apache.zookeeper.server.ServerCnxn; + +import java.util.Arrays; +import java.util.Collections; +import java.util.concurrent.locks.Condition; +import java.util.concurrent.locks.Lock; +import java.util.concurrent.locks.ReentrantLock; + +/** + * Event corresponding to the invocation of the Zookeeper request processor for a request. + */ +public class ReceiptEvent { + private final int opCode; + private final Lock lock = new ReentrantLock(); + private final Condition received = lock.newCondition(); + private final Condition processed = lock.newCondition(); + private State state = State.notReceived; + private boolean sendResponse; + + public ReceiptEvent(int opCode, boolean sendResponse) { + this.opCode = opCode; + this.sendResponse = sendResponse; + } + + public boolean matches(Request request) { + return request.type == opCode; + } + + public void serverReceived() { + lock.lock(); + try { + state = Collections.max(Arrays.asList(state, State.received)); + received.signalAll(); Review Comment: Yes, that is right - removed 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]
