alnzng commented on code in PR #25031: URL: https://github.com/apache/beam/pull/25031#discussion_r1073148188
########## runners/samza/src/main/java/org/apache/beam/runners/samza/util/RunWithTimeout.java: ########## @@ -0,0 +1,42 @@ +/* + * 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.beam.runners.samza.util; + +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +public class RunWithTimeout { Review Comment: Yes, they are similar. But the major difference is that the workflow to handle the timeout value is negative. For the native timeout value, the `CompletableFuture ` throws TimeoutException directly but in our case, the function call will wait forever until the function is completed. I would think it could benefit more that we keep it outside as a general util method since we might want to use it when we implement similar timeout logic for classic mode. WDYT? -- 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]
