HDFS-16709. Remove redundant cast in FSEditLogOp.class (#4667). Contributed by ZanderXu.

Reviewed-by: Inigo Goiri <inigoiri@apache.org>
Reviewed-by: He Xiaoqiao <hexiaoqiao@apache.org>
Signed-off-by: Ayush Saxena <ayushsaxena@apache.org>
This commit is contained in:
xuzq 2022-08-09 03:24:01 +08:00 committed by GitHub
parent 06f0f7db79
commit 895f7c51fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 56 deletions

View File

@ -823,7 +823,7 @@ static class AddOp extends AddCloseOp {
}
static AddOp getInstance(OpInstanceCache cache) {
return (AddOp) cache.get(OP_ADD);
return cache.get(OP_ADD);
}
@Override
@ -851,7 +851,7 @@ static class CloseOp extends AddCloseOp {
}
static CloseOp getInstance(OpInstanceCache cache) {
return (CloseOp)cache.get(OP_CLOSE);
return cache.get(OP_CLOSE);
}
@Override
@ -969,7 +969,7 @@ static class AddBlockOp extends FSEditLogOp {
}
static AddBlockOp getInstance(OpInstanceCache cache) {
return (AddBlockOp) cache.get(OP_ADD_BLOCK);
return cache.get(OP_ADD_BLOCK);
}
@Override
@ -1081,7 +1081,7 @@ static class UpdateBlocksOp extends FSEditLogOp implements BlockListUpdatingOp {
}
static UpdateBlocksOp getInstance(OpInstanceCache cache) {
return (UpdateBlocksOp)cache.get(OP_UPDATE_BLOCKS);
return cache.get(OP_UPDATE_BLOCKS);
}
@Override
@ -1175,7 +1175,7 @@ static class SetReplicationOp extends FSEditLogOp {
}
static SetReplicationOp getInstance(OpInstanceCache cache) {
return (SetReplicationOp)cache.get(OP_SET_REPLICATION);
return cache.get(OP_SET_REPLICATION);
}
@Override
@ -1254,7 +1254,7 @@ static class ConcatDeleteOp extends FSEditLogOp {
}
static ConcatDeleteOp getInstance(OpInstanceCache cache) {
return (ConcatDeleteOp)cache.get(OP_CONCAT_DELETE);
return cache.get(OP_CONCAT_DELETE);
}
@Override
@ -1412,7 +1412,7 @@ static class RenameOldOp extends FSEditLogOp {
}
static RenameOldOp getInstance(OpInstanceCache cache) {
return (RenameOldOp)cache.get(OP_RENAME_OLD);
return cache.get(OP_RENAME_OLD);
}
@Override
@ -1524,7 +1524,7 @@ static class DeleteOp extends FSEditLogOp {
}
static DeleteOp getInstance(OpInstanceCache cache) {
return (DeleteOp)cache.get(OP_DELETE);
return cache.get(OP_DELETE);
}
@Override
@ -1625,7 +1625,7 @@ static class MkdirOp extends FSEditLogOp {
}
static MkdirOp getInstance(OpInstanceCache cache) {
return (MkdirOp)cache.get(OP_MKDIR);
return cache.get(OP_MKDIR);
}
@Override
@ -1798,7 +1798,7 @@ static class SetGenstampV1Op extends FSEditLogOp {
}
static SetGenstampV1Op getInstance(OpInstanceCache cache) {
return (SetGenstampV1Op)cache.get(OP_SET_GENSTAMP_V1);
return cache.get(OP_SET_GENSTAMP_V1);
}
@Override
@ -1864,7 +1864,7 @@ static class SetGenstampV2Op extends FSEditLogOp {
}
static SetGenstampV2Op getInstance(OpInstanceCache cache) {
return (SetGenstampV2Op)cache.get(OP_SET_GENSTAMP_V2);
return cache.get(OP_SET_GENSTAMP_V2);
}
@Override
@ -1922,7 +1922,7 @@ static class AllocateBlockIdOp extends FSEditLogOp {
}
static AllocateBlockIdOp getInstance(OpInstanceCache cache) {
return (AllocateBlockIdOp)cache.get(OP_ALLOCATE_BLOCK_ID);
return cache.get(OP_ALLOCATE_BLOCK_ID);
}
@Override
@ -1981,7 +1981,7 @@ static class SetPermissionsOp extends FSEditLogOp {
}
static SetPermissionsOp getInstance(OpInstanceCache cache) {
return (SetPermissionsOp)cache.get(OP_SET_PERMISSIONS);
return cache.get(OP_SET_PERMISSIONS);
}
@Override
@ -2054,7 +2054,7 @@ static class SetOwnerOp extends FSEditLogOp {
}
static SetOwnerOp getInstance(OpInstanceCache cache) {
return (SetOwnerOp)cache.get(OP_SET_OWNER);
return cache.get(OP_SET_OWNER);
}
@Override
@ -2141,7 +2141,7 @@ static class SetNSQuotaOp extends FSEditLogOp {
}
static SetNSQuotaOp getInstance(OpInstanceCache cache) {
return (SetNSQuotaOp)cache.get(OP_SET_NS_QUOTA);
return cache.get(OP_SET_NS_QUOTA);
}
@Override
@ -2199,7 +2199,7 @@ static class ClearNSQuotaOp extends FSEditLogOp {
}
static ClearNSQuotaOp getInstance(OpInstanceCache cache) {
return (ClearNSQuotaOp)cache.get(OP_CLEAR_NS_QUOTA);
return cache.get(OP_CLEAR_NS_QUOTA);
}
@Override
@ -2253,7 +2253,7 @@ static class SetQuotaOp extends FSEditLogOp {
}
static SetQuotaOp getInstance(OpInstanceCache cache) {
return (SetQuotaOp)cache.get(OP_SET_QUOTA);
return cache.get(OP_SET_QUOTA);
}
@Override
@ -2338,7 +2338,7 @@ static class SetQuotaByStorageTypeOp extends FSEditLogOp {
}
static SetQuotaByStorageTypeOp getInstance(OpInstanceCache cache) {
return (SetQuotaByStorageTypeOp)cache.get(OP_SET_QUOTA_BY_STORAGETYPE);
return cache.get(OP_SET_QUOTA_BY_STORAGETYPE);
}
@Override
@ -2421,7 +2421,7 @@ static class TimesOp extends FSEditLogOp {
}
static TimesOp getInstance(OpInstanceCache cache) {
return (TimesOp)cache.get(OP_TIMES);
return cache.get(OP_TIMES);
}
@Override
@ -2530,7 +2530,7 @@ static class SymlinkOp extends FSEditLogOp {
}
static SymlinkOp getInstance(OpInstanceCache cache) {
return (SymlinkOp)cache.get(OP_SYMLINK);
return cache.get(OP_SYMLINK);
}
@Override
@ -2689,7 +2689,7 @@ static class RenameOp extends FSEditLogOp {
}
static RenameOp getInstance(OpInstanceCache cache) {
return (RenameOp)cache.get(OP_RENAME);
return cache.get(OP_RENAME);
}
@Override
@ -2854,7 +2854,7 @@ static class TruncateOp extends FSEditLogOp {
}
static TruncateOp getInstance(OpInstanceCache cache) {
return (TruncateOp)cache.get(OP_TRUNCATE);
return cache.get(OP_TRUNCATE);
}
@Override
@ -2988,7 +2988,7 @@ static class ReassignLeaseOp extends FSEditLogOp {
}
static ReassignLeaseOp getInstance(OpInstanceCache cache) {
return (ReassignLeaseOp)cache.get(OP_REASSIGN_LEASE);
return cache.get(OP_REASSIGN_LEASE);
}
@Override
@ -3070,7 +3070,7 @@ static class GetDelegationTokenOp extends FSEditLogOp {
}
static GetDelegationTokenOp getInstance(OpInstanceCache cache) {
return (GetDelegationTokenOp)cache.get(OP_GET_DELEGATION_TOKEN);
return cache.get(OP_GET_DELEGATION_TOKEN);
}
@Override
@ -3149,7 +3149,7 @@ static class RenewDelegationTokenOp extends FSEditLogOp {
}
static RenewDelegationTokenOp getInstance(OpInstanceCache cache) {
return (RenewDelegationTokenOp)cache.get(OP_RENEW_DELEGATION_TOKEN);
return cache.get(OP_RENEW_DELEGATION_TOKEN);
}
@Override
@ -3227,7 +3227,7 @@ static class CancelDelegationTokenOp extends FSEditLogOp {
}
static CancelDelegationTokenOp getInstance(OpInstanceCache cache) {
return (CancelDelegationTokenOp)cache.get(OP_CANCEL_DELEGATION_TOKEN);
return cache.get(OP_CANCEL_DELEGATION_TOKEN);
}
@Override
@ -3286,7 +3286,7 @@ static class UpdateMasterKeyOp extends FSEditLogOp {
}
static UpdateMasterKeyOp getInstance(OpInstanceCache cache) {
return (UpdateMasterKeyOp)cache.get(OP_UPDATE_MASTER_KEY);
return cache.get(OP_UPDATE_MASTER_KEY);
}
@Override
@ -3345,7 +3345,7 @@ private LogSegmentOp(FSEditLogOpCodes code) {
static LogSegmentOp getInstance(OpInstanceCache cache,
FSEditLogOpCodes code) {
return (LogSegmentOp)cache.get(code);
return cache.get(code);
}
@Override
@ -3404,7 +3404,7 @@ static class InvalidOp extends FSEditLogOp {
}
static InvalidOp getInstance(OpInstanceCache cache) {
return (InvalidOp)cache.get(OP_INVALID);
return cache.get(OP_INVALID);
}
@Override
@ -3457,7 +3457,7 @@ public CreateSnapshotOp() {
}
static CreateSnapshotOp getInstance(OpInstanceCache cache) {
return (CreateSnapshotOp)cache.get(OP_CREATE_SNAPSHOT);
return cache.get(OP_CREATE_SNAPSHOT);
}
@Override
@ -3562,7 +3562,7 @@ static class DeleteSnapshotOp extends FSEditLogOp {
}
static DeleteSnapshotOp getInstance(OpInstanceCache cache) {
return (DeleteSnapshotOp)cache.get(OP_DELETE_SNAPSHOT);
return cache.get(OP_DELETE_SNAPSHOT);
}
@Override
@ -3669,7 +3669,7 @@ static class RenameSnapshotOp extends FSEditLogOp {
}
static RenameSnapshotOp getInstance(OpInstanceCache cache) {
return (RenameSnapshotOp) cache.get(OP_RENAME_SNAPSHOT);
return cache.get(OP_RENAME_SNAPSHOT);
}
@Override
@ -3788,7 +3788,7 @@ public AllowSnapshotOp(String snapRoot) {
}
static AllowSnapshotOp getInstance(OpInstanceCache cache) {
return (AllowSnapshotOp) cache.get(OP_ALLOW_SNAPSHOT);
return cache.get(OP_ALLOW_SNAPSHOT);
}
@Override
@ -3847,7 +3847,7 @@ public DisallowSnapshotOp(String snapRoot) {
}
static DisallowSnapshotOp getInstance(OpInstanceCache cache) {
return (DisallowSnapshotOp) cache.get(OP_DISALLOW_SNAPSHOT);
return cache.get(OP_DISALLOW_SNAPSHOT);
}
void resetSubFields() {
@ -3901,7 +3901,7 @@ public AddCacheDirectiveInfoOp() {
}
static AddCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (AddCacheDirectiveInfoOp) cache.get(OP_ADD_CACHE_DIRECTIVE);
return cache.get(OP_ADD_CACHE_DIRECTIVE);
}
@Override
@ -3971,7 +3971,7 @@ public ModifyCacheDirectiveInfoOp() {
}
static ModifyCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (ModifyCacheDirectiveInfoOp) cache.get(OP_MODIFY_CACHE_DIRECTIVE);
return cache.get(OP_MODIFY_CACHE_DIRECTIVE);
}
@Override
@ -4047,7 +4047,7 @@ public RemoveCacheDirectiveInfoOp() {
}
static RemoveCacheDirectiveInfoOp getInstance(OpInstanceCache cache) {
return (RemoveCacheDirectiveInfoOp) cache.get(OP_REMOVE_CACHE_DIRECTIVE);
return cache.get(OP_REMOVE_CACHE_DIRECTIVE);
}
@Override
@ -4104,7 +4104,7 @@ public AddCachePoolOp() {
}
static AddCachePoolOp getInstance(OpInstanceCache cache) {
return (AddCachePoolOp) cache.get(OP_ADD_CACHE_POOL);
return cache.get(OP_ADD_CACHE_POOL);
}
@Override
@ -4170,7 +4170,7 @@ public ModifyCachePoolOp() {
}
static ModifyCachePoolOp getInstance(OpInstanceCache cache) {
return (ModifyCachePoolOp) cache.get(OP_MODIFY_CACHE_POOL);
return cache.get(OP_MODIFY_CACHE_POOL);
}
@Override
@ -4243,7 +4243,7 @@ public RemoveCachePoolOp() {
}
static RemoveCachePoolOp getInstance(OpInstanceCache cache) {
return (RemoveCachePoolOp) cache.get(OP_REMOVE_CACHE_POOL);
return cache.get(OP_REMOVE_CACHE_POOL);
}
@Override
@ -4300,7 +4300,7 @@ static class RemoveXAttrOp extends FSEditLogOp {
}
static RemoveXAttrOp getInstance(OpInstanceCache cache) {
return (RemoveXAttrOp) cache.get(OP_REMOVE_XATTR);
return cache.get(OP_REMOVE_XATTR);
}
@Override
@ -4353,7 +4353,7 @@ static class SetXAttrOp extends FSEditLogOp {
}
static SetXAttrOp getInstance(OpInstanceCache cache) {
return (SetXAttrOp) cache.get(OP_SET_XATTR);
return cache.get(OP_SET_XATTR);
}
@Override
@ -4406,7 +4406,7 @@ static class SetAclOp extends FSEditLogOp {
}
static SetAclOp getInstance(OpInstanceCache cache) {
return (SetAclOp) cache.get(OP_SET_ACL);
return cache.get(OP_SET_ACL);
}
@Override
@ -4507,8 +4507,7 @@ static class AddErasureCodingPolicyOp extends FSEditLogOp {
}
static AddErasureCodingPolicyOp getInstance(OpInstanceCache cache) {
return (AddErasureCodingPolicyOp) cache
.get(OP_ADD_ERASURE_CODING_POLICY);
return cache.get(OP_ADD_ERASURE_CODING_POLICY);
}
@Override
@ -4620,8 +4619,7 @@ static class EnableErasureCodingPolicyOp extends FSEditLogOp {
}
static EnableErasureCodingPolicyOp getInstance(OpInstanceCache cache) {
return (EnableErasureCodingPolicyOp) cache
.get(OP_ENABLE_ERASURE_CODING_POLICY);
return cache.get(OP_ENABLE_ERASURE_CODING_POLICY);
}
@Override
@ -4689,8 +4687,7 @@ static class DisableErasureCodingPolicyOp extends FSEditLogOp {
}
static DisableErasureCodingPolicyOp getInstance(OpInstanceCache cache) {
return (DisableErasureCodingPolicyOp) cache
.get(OP_DISABLE_ERASURE_CODING_POLICY);
return cache.get(OP_DISABLE_ERASURE_CODING_POLICY);
}
@Override
@ -4756,8 +4753,7 @@ static class RemoveErasureCodingPolicyOp extends FSEditLogOp {
}
static RemoveErasureCodingPolicyOp getInstance(OpInstanceCache cache) {
return (RemoveErasureCodingPolicyOp) cache
.get(OP_REMOVE_ERASURE_CODING_POLICY);
return cache.get(OP_REMOVE_ERASURE_CODING_POLICY);
}
@Override
@ -4879,7 +4875,7 @@ static class SetStoragePolicyOp extends FSEditLogOp {
}
static SetStoragePolicyOp getInstance(OpInstanceCache cache) {
return (SetStoragePolicyOp) cache.get(OP_SET_STORAGE_POLICY);
return cache.get(OP_SET_STORAGE_POLICY);
}
@Override
@ -4946,7 +4942,7 @@ static class RollingUpgradeStartOp extends RollingUpgradeOp {
}
static RollingUpgradeStartOp getInstance(OpInstanceCache cache) {
return (RollingUpgradeStartOp) cache.get(OP_ROLLING_UPGRADE_START);
return cache.get(OP_ROLLING_UPGRADE_START);
}
}
@ -4956,7 +4952,7 @@ static class RollingUpgradeFinalizeOp extends RollingUpgradeOp {
}
static RollingUpgradeFinalizeOp getInstance(OpInstanceCache cache) {
return (RollingUpgradeFinalizeOp) cache.get(OP_ROLLING_UPGRADE_FINALIZE);
return cache.get(OP_ROLLING_UPGRADE_FINALIZE);
}
}

View File

@ -581,8 +581,8 @@ public void run() {
}
static SetOwnerOp getSetOwnerOp(OpInstanceCache cache, String group) {
return ((SetOwnerOp)cache.get(OP_SET_OWNER))
.setSource("/").setUser("u").setGroup(group);
SetOwnerOp setOwnerOp = cache.get(OP_SET_OWNER);
return setOwnerOp.setSource("/").setUser("u").setGroup(group);
}
static class BlockingOpMatcher implements ArgumentMatcher<FSEditLogOp> {