You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-dev@hadoop.apache.org by "Ayush Saxena (Jira)" <ji...@apache.org> on 2022/08/08 19:25:00 UTC

[jira] [Resolved] (HDFS-16709) Remove redundant cast in FSEditLogOp.class

     [ https://issues.apache.org/jira/browse/HDFS-16709?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ayush Saxena resolved HDFS-16709.
---------------------------------
    Fix Version/s: 3.4.0
     Hadoop Flags: Reviewed
       Resolution: Fixed

> Remove redundant cast in FSEditLogOp.class
> ------------------------------------------
>
>                 Key: HDFS-16709
>                 URL: https://issues.apache.org/jira/browse/HDFS-16709
>             Project: Hadoop HDFS
>          Issue Type: Improvement
>            Reporter: ZanderXu
>            Assignee: ZanderXu
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 3.4.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> When I read some class about Edits of NameNode, I found that there are much redundant cast inĀ FSEditLogOp.class, I feel that we should remove them.
> Such as:
> {code:java}
> static UpdateBlocksOp getInstance(OpInstanceCache cache) {
>   return (UpdateBlocksOp)cache.get(OP_UPDATE_BLOCKS);
> } {code}
> Because cache.get() have cast the response to T, such as:
> {code:java}
> @SuppressWarnings("unchecked")
> public <T extends FSEditLogOp> T get(FSEditLogOpCodes opCode) {
>   return useCache ? (T)CACHE.get().get(opCode) : (T)newInstance(opCode);
> } {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-dev-help@hadoop.apache.org