Search in sources :

Example 21 with ClientProtocol

use of org.apache.hadoop.hdfs.protocol.ClientProtocol in project hadoop by apache.

the class TestRetryCacheWithHA method genClientWithDummyHandler.

private DFSClient genClientWithDummyHandler() throws IOException {
    URI nnUri = dfs.getUri();
    FailoverProxyProvider<ClientProtocol> failoverProxyProvider = NameNodeProxiesClient.createFailoverProxyProvider(conf, nnUri, ClientProtocol.class, true, null);
    InvocationHandler dummyHandler = new DummyRetryInvocationHandler(failoverProxyProvider, RetryPolicies.failoverOnNetworkException(RetryPolicies.TRY_ONCE_THEN_FAIL, Integer.MAX_VALUE, HdfsClientConfigKeys.Failover.SLEEPTIME_BASE_DEFAULT, HdfsClientConfigKeys.Failover.SLEEPTIME_MAX_DEFAULT));
    ClientProtocol proxy = (ClientProtocol) Proxy.newProxyInstance(failoverProxyProvider.getInterface().getClassLoader(), new Class[] { ClientProtocol.class }, dummyHandler);
    DFSClient client = new DFSClient(null, proxy, conf, null);
    return client;
}
Also used : DFSClient(org.apache.hadoop.hdfs.DFSClient) ClientProtocol(org.apache.hadoop.hdfs.protocol.ClientProtocol) URI(java.net.URI) RetryInvocationHandler(org.apache.hadoop.io.retry.RetryInvocationHandler) InvocationHandler(java.lang.reflect.InvocationHandler)

Aggregations

ClientProtocol (org.apache.hadoop.hdfs.protocol.ClientProtocol)21 Configuration (org.apache.hadoop.conf.Configuration)14 HdfsConfiguration (org.apache.hadoop.hdfs.HdfsConfiguration)10 URI (java.net.URI)8 DistributedFileSystem (org.apache.hadoop.hdfs.DistributedFileSystem)8 ProxyAndInfo (org.apache.hadoop.hdfs.NameNodeProxiesClient.ProxyAndInfo)7 IOException (java.io.IOException)5 LocatedBlock (org.apache.hadoop.hdfs.protocol.LocatedBlock)5 Path (org.apache.hadoop.fs.Path)4 Test (org.junit.Test)4 DFSClient (org.apache.hadoop.hdfs.DFSClient)3 LocatedBlocks (org.apache.hadoop.hdfs.protocol.LocatedBlocks)3 Field (java.lang.reflect.Field)2 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 InetSocketAddress (java.net.InetSocketAddress)2 FileSystem (org.apache.hadoop.fs.FileSystem)2 StorageType (org.apache.hadoop.fs.StorageType)2 FsPermission (org.apache.hadoop.fs.permission.FsPermission)2 MiniDFSCluster (org.apache.hadoop.hdfs.MiniDFSCluster)2 ClientNamenodeProtocolPB (org.apache.hadoop.hdfs.protocolPB.ClientNamenodeProtocolPB)2