long sleeptime = 400;
while (true) {
long localstart = System.currentTimeMillis();
while (true) {
try {
VersionedLocatedBlock loc = null;
if (dfsClient.namenodeProtocolProxy != null
&& dfsClient.namenodeProtocolProxy.isMethodSupported(
"addBlockAndFetchMetaInfo", String.class, String.class,
DatanodeInfo[].class, DatanodeInfo[].class, long.class,
Block.class)) {
loc = dfsClient.namenode.addBlockAndFetchMetaInfo(src,
dfsClient.clientName, excludedNodes, favoredNodes,
this.lastBlkOffset, getLastBlock());
} else if (dfsClient.namenodeProtocolProxy != null
&& dfsClient.namenodeProtocolProxy.isMethodSupported(
"addBlockAndFetchMetaInfo", String.class, String.class,
DatanodeInfo[].class, DatanodeInfo[].class, long.class)) {
loc = dfsClient.namenode.addBlockAndFetchMetaInfo(src,
dfsClient.clientName, excludedNodes, favoredNodes, this.lastBlkOffset);
} else if (dfsClient.namenodeProtocolProxy != null
&& dfsClient.namenodeProtocolProxy.isMethodSupported(
"addBlockAndFetchMetaInfo", String.class, String.class,
DatanodeInfo[].class, long.class)) {
loc = dfsClient.namenode.addBlockAndFetchMetaInfo(src,
dfsClient.clientName, excludedNodes, this.lastBlkOffset);
} else if (dfsClient.namenodeProtocolProxy != null
&& dfsClient.namenodeProtocolProxy.isMethodSupported(
"addBlockAndFetchMetaInfo", String.class, String.class,
DatanodeInfo[].class)) {
loc = dfsClient.namenode.addBlockAndFetchMetaInfo(src,
dfsClient.clientName, excludedNodes);
} else if (dfsClient.namenodeProtocolProxy != null
&& dfsClient.namenodeProtocolProxy.isMethodSupported(
"addBlockAndFetchVersion", String.class, String.class,
DatanodeInfo[].class)) {
loc = dfsClient.namenode.addBlockAndFetchVersion(src,
dfsClient.clientName, excludedNodes);
} else if (dfsClient.namenodeProtocolProxy != null
&& dfsClient.namenodeProtocolProxy.isMethodSupported("addBlock",
String.class, String.class, DatanodeInfo[].class)) {
return dfsClient.namenode.addBlock(src, dfsClient.clientName,
excludedNodes);
} else {
return dfsClient.namenode.addBlock(src, dfsClient.clientName);
}
dfsClient.updateDataTransferProtocolVersionIfNeeded(
loc.getDataProtocolVersion());
if (loc instanceof LocatedBlockWithMetaInfo) {
LocatedBlockWithMetaInfo metaLoc = (LocatedBlockWithMetaInfo)loc;
dfsClient.updateNamespaceIdIfNeeded(metaLoc.getNamespaceID());
dfsClient.getNewNameNodeIfNeeded(metaLoc.getMethodFingerPrint());
}