zhangyue19921010 commented on code in PR #5416: URL: https://github.com/apache/hudi/pull/5416#discussion_r989697092
########## hudi-common/src/main/java/org/apache/hudi/common/util/queue/HoodieMessageQueue.java: ########## @@ -0,0 +1,28 @@ +/* + * 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.hudi.common.util.queue; + +public abstract class HoodieMessageQueue<I, O> { Review Comment: > Same comments as above (please ditto for all interfaces) Changed all. > This API seems incomplete: we do have methods to insert into the queue, but we don't have a method to take from the queue Now there are 4 func in interface HoodieMessageQueue ``` public interface HoodieMessageQueue<I, O> { /** * Get the size of inner message queue. */ long size(); /** * Insert a record into inner message queue. */ void insertRecord(I t) throws Exception; /** * Read records from inner message queue. */ Option<O> readNextRecord(); void close(); } ``` ########## hudi-common/src/main/java/org/apache/hudi/common/util/queue/WaitStrategyFactory.java: ########## @@ -0,0 +1,53 @@ +/* + * 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.hudi.common.util.queue; + +import static org.apache.hudi.common.util.queue.DisruptorWaitStrategyType.BLOCKINGWAITSTRATEGY; + +import com.lmax.disruptor.BlockingWaitStrategy; +import com.lmax.disruptor.BusySpinWaitStrategy; +import com.lmax.disruptor.SleepingWaitStrategy; +import com.lmax.disruptor.WaitStrategy; +import com.lmax.disruptor.YieldingWaitStrategy; +import org.apache.hudi.exception.HoodieException; + +public class WaitStrategyFactory { + + public static final String DEFAULT_STRATEGY = BLOCKINGWAITSTRATEGY.name(); + + /** + * Build WaitStrategy for disruptor + */ + public static WaitStrategy build(String name) { + + DisruptorWaitStrategyType strategyType = DisruptorWaitStrategyType.valueOf(name.toUpperCase()); + switch (strategyType) { + case BLOCKINGWAITSTRATEGY: Review Comment: changed! -- 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]
