private BlockingInterface createProxyInternal() throws IOException { @SuppressWarnings("unchecked") ProtocolProxy<BlockingInterface> proxy = (ProtocolProxy<BlockingInterface>) RPC.getProtocolProxy(blockingInterfaceClass, 0, serverAddr, UserGroupInformation.getCurrentUser(), conf, socketFactory, 0, retryPolicy); return proxy.getProxy(); } }
@Override @SuppressWarnings("unchecked") public <T> ProtocolProxy<T> getProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, UserGroupInformation ticket, Configuration conf, SocketFactory factory, int rpcTimeout, RetryPolicy connectionRetryPolicy, AtomicBoolean fallbackToSimpleAuth) throws IOException { final Invoker invoker = new Invoker(protocol, addr, ticket, conf, factory, rpcTimeout, connectionRetryPolicy, fallbackToSimpleAuth); return new ProtocolProxy<T>(protocol, (T) Proxy.newProxyInstance( protocol.getClassLoader(), new Class[]{protocol}, invoker), false); }
if (cdp.isMethodSupported("getBlockInfo", int.class, Block.class)) { newBlock = cdp.getProxy().getBlockInfo( namespaceId, locatedblock.getBlock()); } else { newBlock = cdp.getProxy().getBlockInfo(locatedblock.getBlock()); RPC.stopProxy(cdp.getProxy());
public boolean isConcatAvailable() throws IOException { if(namenodeProtocolProxy == null) { if(namenodeVersion >= ClientProtocol.CONCAT_VERSION) return true; } else { return namenodeProtocolProxy.isMethodSupported( "concat", String.class, String[].class); } return false; }
primary = createClientDNProtocolProxy(primaryNode, conf, recoverTimeout); if (primary.isMethodSupported("recoverBlock", int.class, Block.class, boolean.class, DatanodeInfo[].class, long.class)) { newBlock = primary.getProxy().recoverBlock(namespaceId, block, isAppend, newnodes, System.currentTimeMillis() + recoverTimeout - socketTimeout); } else if (primary.isMethodSupported("recoverBlock", int.class, Block.class, boolean.class, DatanodeInfo[].class)) { newBlock = primary.getProxy().recoverBlock( namespaceId, block, isAppend, newnodes); } else { newBlock = primary.getProxy().recoverBlock(block, isAppend, newnodes); } finally { if (primary != null) { RPC.stopProxy(primary.getProxy());
public static boolean isMetaInfoSuppoted(ProtocolProxy<ClientProtocol> proxy) throws IOException { return proxy != null && proxy.isMethodSupported( "openAndFetchMetaInfo", String.class, long.class, long.class); }
/** Construct a client-side proxy object that implements the named protocol, * talking to a server at the named address. * @param <T>*/ public static <T> T getProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, UserGroupInformation ticket, Configuration conf, SocketFactory factory) throws IOException { return getProtocolProxy( protocol, clientVersion, addr, ticket, conf, factory).getProxy(); }
/** Construct a client-side proxy object that implements the named protocol, * talking to a server at the named address. * @param <T>*/ @Override @SuppressWarnings("unchecked") public <T> ProtocolProxy<T> getProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, UserGroupInformation ticket, Configuration conf, SocketFactory factory, int rpcTimeout, RetryPolicy connectionRetryPolicy, AtomicBoolean fallbackToSimpleAuth) throws IOException { if (connectionRetryPolicy != null) { throw new UnsupportedOperationException( "Not supported: connectionRetryPolicy=" + connectionRetryPolicy); } T proxy = (T) Proxy.newProxyInstance(protocol.getClassLoader(), new Class[] { protocol }, new Invoker(protocol, addr, ticket, conf, factory, rpcTimeout, fallbackToSimpleAuth)); return new ProtocolProxy<T>(protocol, proxy, true); }
if (datanode.isMethodSupported("getBlockPathInfo", int.class, Block.class)) { pathinfo = datanode.getProxy().getBlockPathInfo(namespaceid, blk); } else { pathinfo = datanode.getProxy().getBlockPathInfo(blk);
public String getClusterName() throws IOException { if (namenodeProtocolProxy.isMethodSupported( "getClusterName")) { return namenode.getClusterName(); } else { return null; } }
/** Construct a client-side proxy object that implements the named protocol, * talking to a server at the named address. * @param <T>*/ public static <T> T getProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf, SocketFactory factory) throws IOException { return getProtocolProxy( protocol, clientVersion, addr, conf, factory).getProxy(); }
@Override public ProtocolProxy<ProtocolMetaInfoPB> getProtocolMetaInfoProxy( ConnectionId connId, Configuration conf, SocketFactory factory) throws IOException { Class<ProtocolMetaInfoPB> protocol = ProtocolMetaInfoPB.class; return new ProtocolProxy<ProtocolMetaInfoPB>(protocol, (ProtocolMetaInfoPB) Proxy.newProxyInstance(protocol.getClassLoader(), new Class[] { protocol }, new Invoker(protocol, connId, conf, factory)), false); }
/** Re-populate the namespace and diskspace count of every node with quota */ public void recount() throws IOException { if (namenodeProtocolProxy.isMethodSupported("recount")) { namenode.recount(); } } /**
/** * Get a proxy connection to a remote server * * @param protocol protocol class * @param clientVersion client version * @param addr remote address * @param conf configuration to use * @param connTimeout time in milliseconds before giving up * @return the proxy * @throws IOException if the far end through a RemoteException */ public static <T> T waitForProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, Configuration conf, long connTimeout) throws IOException { return waitForProtocolProxy(protocol, clientVersion, addr, conf, connTimeout).getProxy(); }
@Override @SuppressWarnings("unchecked") public <T> ProtocolProxy<T> getProxy(Class<T> protocol, long clientVersion, InetSocketAddress addr, UserGroupInformation ticket, Configuration conf, SocketFactory factory, int rpcTimeout, RetryPolicy connectionRetryPolicy, AtomicBoolean fallbackToSimpleAuth) throws IOException { final Invoker invoker = new Invoker(protocol, addr, ticket, conf, factory, rpcTimeout, connectionRetryPolicy, fallbackToSimpleAuth); return new ProtocolProxy<T>(protocol, (T) Proxy.newProxyInstance( protocol.getClassLoader(), new Class[]{protocol}, invoker), false); }
private boolean closeFileOnNameNode(String src, long fileLen, Block lastBlockId) throws IOException { boolean fileComplete; if (namenodeProtocolProxy != null && namenodeProtocolProxy.isMethodSupported("complete", String.class, String.class, long.class, Block.class)) { fileComplete = namenode.complete(src, clientName, fileLen, lastBlockId); } else if (namenodeProtocolProxy != null && namenodeProtocolProxy.isMethodSupported("complete", String.class, String.class, long.class)) { fileComplete = namenode.complete(src, clientName, fileLen); } else { fileComplete = namenode.complete(src, clientName); } return fileComplete; }