[ https://issues.apache.org/jira/browse/HDFS-17596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17873090#comment-17873090 ]
ASF GitHub Bot commented on HDFS-17596: --------------------------------------- hfutatzhanghb commented on code in PR #6988: URL: https://github.com/apache/hadoop/pull/6988#discussion_r1714624377 ########## hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/AsyncRouterStoragePolicy.java: ########## @@ -0,0 +1,62 @@ +/** + * 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.hdfs.server.federation.router; + +import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy; +import org.apache.hadoop.hdfs.server.federation.resolver.RemoteLocation; +import org.apache.hadoop.hdfs.server.namenode.NameNode; + +import java.io.IOException; +import java.util.List; + +import static org.apache.hadoop.hdfs.server.federation.router.async.AsyncUtil.asyncReturn; + +public class AsyncRouterStoragePolicy extends RouterStoragePolicy { Review Comment: @KeeProMise Sir, thanks for reviewing. OK, i will fix it and we keep the same style for other Class name. ########## hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/AsyncRouterStoragePolicy.java: ########## @@ -0,0 +1,62 @@ +/** + * 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.hdfs.server.federation.router; + +import org.apache.hadoop.hdfs.protocol.BlockStoragePolicy; +import org.apache.hadoop.hdfs.server.federation.resolver.RemoteLocation; +import org.apache.hadoop.hdfs.server.namenode.NameNode; + +import java.io.IOException; +import java.util.List; + +import static org.apache.hadoop.hdfs.server.federation.router.async.AsyncUtil.asyncReturn; + +public class AsyncRouterStoragePolicy extends RouterStoragePolicy { + /** RPC server to receive client calls. */ + private final RouterRpcServer rpcServer; + /** RPC clients to connect to the Namenodes. */ + private final RouterRpcClient rpcClient; + + public AsyncRouterStoragePolicy(RouterRpcServer server) { + super(server); + this.rpcServer = server; + this.rpcClient = this.rpcServer.getRPCClient(); + } + + @Override + public BlockStoragePolicy getStoragePolicy(String path) + throws IOException { + rpcServer.checkOperation(NameNode.OperationCategory.READ, true); + + List<RemoteLocation> locations = + rpcServer.getLocationsForPath(path, false, false); + RemoteMethod method = new RemoteMethod("getStoragePolicy", + new Class<?>[] {String.class}, + new RemoteParam()); Review Comment: have done > [ARR] RouterStoragePolicy supports asynchronous rpc. > ---------------------------------------------------- > > Key: HDFS-17596 > URL: https://issues.apache.org/jira/browse/HDFS-17596 > Project: Hadoop HDFS > Issue Type: Sub-task > Reporter: Jian Zhang > Assignee: farmmamba > Priority: Major > Labels: pull-request-available > > *Describe* > The main new addition is RouterAsyncStoragePolicy, which extends > RouterStoragePolicy so that supports asynchronous rpc. -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org