-
Notifications
You must be signed in to change notification settings - Fork 9.1k
HADOOP-19525: used java.time.Clock instead of org.apache.hadoop.util.Clock #7570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: trunk
Are you sure you want to change the base?
Conversation
💔 -1 overall
This message was automatically generated. |
0192cc1
to
3e7a4ee
Compare
💔 -1 overall
This message was automatically generated. |
3e7a4ee
to
c40437d
Compare
*/ | ||
@Public | ||
@Stable | ||
@Deprecated |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was added in YARN-11765 (3.5.0, an unreleased version), why not just revert the change first?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pan3793 You're right, it would appear as if 3.5.0 new deprecated classes!
I've removed the moved classes in the latest commit.
💔 -1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
💔 -1 overall
This message was automatically generated. |
48fe431
to
f3f1798
Compare
🎊 +1 overall
This message was automatically generated. |
@pan3793 @slfan1989 @cnauroth - this rides on the waves of @yangjiandan's work in #7352 for YARN-11765. |
* Subclasses that want to change this behavior can either override relevant methods or | ||
* subclass {@link java.time.Clock} directly. | ||
*/ | ||
public abstract class AbstractClock extends Clock { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a public api but seems unnecessary
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the rest of changes lgtm
sorry, I have to retract this after a closer look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pan3793 thanks for the review!
This just serves as base class for Clock
s that don't need to deal with ZoneId
s and mostly handle times natively via milliseconds (converting to Instant
s and not vice-versa).
The alternative would be to just delete it and have the two subclasses implement this common behavior.
I can also mark it with @LimitedPrivate
and limit it to either -
- The only module currently using it (YARN, in ControlledClock)
- All modules currently using
java.time.Clock
(after this change - YARN, tools, MapReduce)
I think I prefer the first approach (delete the class) since it doesn't save too much boilerplate anyway.
wdyt?
import java.util.Collection; | ||
|
||
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler; | ||
import org.apache.hadoop.util.Clock; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just took a closer look, org.apache.hadoop.util.Clock
was actually exposed to the public API, such changes bring unnecessary compatibility issues. Given Hadoop is already in a post-mature state, I would avoid such changes as much as possible.
Back to the original intention of the changes, how about leaving the org.apache.hadoop.yarn.util.Clock
as-is (which means reverting YARN-11765), and introducing a new Clock implementation in the Common module based on the JDK Clock
for new use cases?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pan3793 you're completely right, but YARN-11765 was already merged - and changed the same public API (by moving the class from import org.apache.hadoop.yarn.util
to org.apache.hadoop.util
).
Description of PR
Closes HADOOP-19525
How was this patch tested?
Ran all existing tests.
For code changes:
LICENSE
,LICENSE-binary
,NOTICE-binary
files?