[
https://issues.apache.org/jira/browse/YARN-11765?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17927038#comment-17927038
]
ASF GitHub Bot commented on YARN-11765:
---------------------------------------
yangjiandan commented on code in PR #7352:
URL: https://github.com/apache/hadoop/pull/7352#discussion_r1955506616
##########
hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/util/SystemClock.java:
##########
@@ -0,0 +1,49 @@
+/**
+* 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.util;
+
+import org.apache.hadoop.classification.InterfaceAudience.Public;
+import org.apache.hadoop.classification.InterfaceStability.Stable;
+
+/**
+ * Implementation of {@link Clock} that gives the current time from the system
+ * clock in milliseconds.
+ *
+ * NOTE: Do not use this to calculate a duration of expire or interval to
sleep,
+ * because it will be broken by settimeofday. Please use {@link MonotonicClock}
+ * instead.
+ */
+@Public
+@Stable
+public final class SystemClock implements Clock {
+
+ private static final SystemClock INSTANCE = new SystemClock();
+
+ public static SystemClock getInstance() {
+ return INSTANCE;
+ }
+
+ @Deprecated
Review Comment:
@cnauroth Thanks for your review! I looked into the commit history and found
that this change was introduced in YARN-4816 to fix a compatibility issue.
Theoretically, this public constructor is also exposed as part of the API
interface. So, to ensure compatibility, it would be safer to keep this change
for now.
> Refactor: Move Clock Class from hadoop-mapreduce-project to
> hadoop-common-project for Reusability
> -------------------------------------------------------------------------------------------------
>
> Key: YARN-11765
> URL: https://issues.apache.org/jira/browse/YARN-11765
> Project: Hadoop YARN
> Issue Type: Improvement
> Components: yarn, yarn-common
> Reporter: Jiandan Yang
> Assignee: Jiandan Yang
> Priority: Major
> Labels: pull-request-available
>
> *Background:*
>
> Currently, both hadoop-mapreduce-project and hadoop-yarn-project define their
> own versions of the Clock class. This leads to redundant class definitions
> across different Hadoop subprojects, reducing maintainability and code
> reusability.
>
> To {*}avoid duplicate definitions and improve class reuse{*}, we propose
> *moving the* Clock *class from* hadoop-mapreduce-project *to*
> hadoop-common-project, making it available as a shared utility for all Hadoop
> components.
>
> *Proposal:*
> 1.{*}Move the{*} Clock *interface and its implementions from*
> hadoop-mapreduce-project *to* hadoop-common-project, ensuring it becomes a
> shared utility accessible to all subprojects.
> 2. *Update all references* in hadoop-mapreduce-project and
> hadoop-yarn-project to use the newly relocated Clock class in
> hadoop-common-project.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]