This is an automated email from the ASF dual-hosted git repository. jinglun pushed a commit to branch HADOOP-19236-original in repository https://gitbox.apache.org/repos/asf/hadoop.git
commit c165d84ef3653a455f7e98e1ecbf2f0b2798d24c Author: lijinglun <lijing...@bytedance.com> AuthorDate: Mon Aug 12 19:37:35 2024 +0800 Integration of TOS: Add lazy reload interface to common. --- .../apache/hadoop/fs/tosfs/common/CommonUtils.java | 44 ++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/common/CommonUtils.java b/hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/common/CommonUtils.java new file mode 100644 index 00000000000..a5d8f72cec0 --- /dev/null +++ b/hadoop-cloud-storage-project/hadoop-tos/src/main/java/org/apache/hadoop/fs/tosfs/common/CommonUtils.java @@ -0,0 +1,44 @@ +/* + * 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.hadoop.fs.tosfs.common; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CommonUtils { + private static final Logger LOG = LoggerFactory.getLogger(CommonUtils.class); + + public static void runQuietly(RunWithException run) { + runQuietly(run, true); + } + + public static void runQuietly(RunWithException run, boolean logError) { + try { + run.run(); + } catch (Exception e) { + if (logError) { + LOG.info("Encounter error but can be ignored: ", e); + } + } + } + + public interface RunWithException { + void run() throws Exception; + } +} --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org