id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
119,500 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java | DFSUtil.getNNServiceRpcAddresses | public static List<InetSocketAddress> getNNServiceRpcAddresses(
Configuration conf) throws IOException {
// Use default address as fall back
String defaultAddress;
try {
defaultAddress = NameNode.getDefaultAddress(conf);
} catch (IllegalArgumentException e) {
defaultAddress = null;
... | java | public static List<InetSocketAddress> getNNServiceRpcAddresses(
Configuration conf) throws IOException {
// Use default address as fall back
String defaultAddress;
try {
defaultAddress = NameNode.getDefaultAddress(conf);
} catch (IllegalArgumentException e) {
defaultAddress = null;
... | [
"public",
"static",
"List",
"<",
"InetSocketAddress",
">",
"getNNServiceRpcAddresses",
"(",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"// Use default address as fall back",
"String",
"defaultAddress",
";",
"try",
"{",
"defaultAddress",
"=",
"NameNode",
... | Returns list of InetSocketAddresses corresponding to namenodes from the
configuration. Note this is to be used by datanodes to get the list of
namenode addresses to talk to.
Returns namenode address specifically configured for datanodes (using
service ports), if found. If not, regular RPC address configured for other
... | [
"Returns",
"list",
"of",
"InetSocketAddresses",
"corresponding",
"to",
"namenodes",
"from",
"the",
"configuration",
".",
"Note",
"this",
"is",
"to",
"be",
"used",
"by",
"datanodes",
"to",
"get",
"the",
"list",
"of",
"namenode",
"addresses",
"to",
"talk",
"to",... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L670-L689 |
119,501 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java | DFSUtil.getInfoServer | public static String getInfoServer(
InetSocketAddress namenode, Configuration conf, boolean isAvatar) {
String httpAddressDefault =
NetUtils.getServerAddress(conf, "dfs.info.bindAddress",
"dfs.info.port", "dfs.http.address");
String httpAddress = null;
if(n... | java | public static String getInfoServer(
InetSocketAddress namenode, Configuration conf, boolean isAvatar) {
String httpAddressDefault =
NetUtils.getServerAddress(conf, "dfs.info.bindAddress",
"dfs.info.port", "dfs.http.address");
String httpAddress = null;
if(n... | [
"public",
"static",
"String",
"getInfoServer",
"(",
"InetSocketAddress",
"namenode",
",",
"Configuration",
"conf",
",",
"boolean",
"isAvatar",
")",
"{",
"String",
"httpAddressDefault",
"=",
"NetUtils",
".",
"getServerAddress",
"(",
"conf",
",",
"\"dfs.info.bindAddress... | return server http address from the configuration
@param conf
@param namenode - namenode address
@param isAvatar - whether it's avatar config
@return server http | [
"return",
"server",
"http",
"address",
"from",
"the",
"configuration"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L745-L799 |
119,502 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java | DFSUtil.isDefaultNamenodeAddress | public static boolean isDefaultNamenodeAddress(Configuration conf,
InetSocketAddress address, String... keys) {
for (String key : keys) {
String candidateAddress = conf.get(key);
if (candidateAddress != null
&& address.equals(NetUtils.createSocketAddr(candidateAddress)))
return t... | java | public static boolean isDefaultNamenodeAddress(Configuration conf,
InetSocketAddress address, String... keys) {
for (String key : keys) {
String candidateAddress = conf.get(key);
if (candidateAddress != null
&& address.equals(NetUtils.createSocketAddr(candidateAddress)))
return t... | [
"public",
"static",
"boolean",
"isDefaultNamenodeAddress",
"(",
"Configuration",
"conf",
",",
"InetSocketAddress",
"address",
",",
"String",
"...",
"keys",
")",
"{",
"for",
"(",
"String",
"key",
":",
"keys",
")",
"{",
"String",
"candidateAddress",
"=",
"conf",
... | Given the InetSocketAddress for any configured communication with a
namenode, this method determines whether it is the configured
communication channel for the "default" namenode.
It does a reverse lookup on the list of default communication parameters
to see if the given address matches any of them.
Since the process ... | [
"Given",
"the",
"InetSocketAddress",
"for",
"any",
"configured",
"communication",
"with",
"a",
"namenode",
"this",
"method",
"determines",
"whether",
"it",
"is",
"the",
"configured",
"communication",
"channel",
"for",
"the",
"default",
"namenode",
".",
"It",
"does... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L832-L841 |
119,503 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java | DFSUtil.setGenericConf | public static void setGenericConf(Configuration conf,
String nameserviceId, String... keys) {
for (String key : keys) {
String value = conf.get(getNameServiceIdKey(key, nameserviceId));
if (value != null) {
conf.set(key, value);
}
}
} | java | public static void setGenericConf(Configuration conf,
String nameserviceId, String... keys) {
for (String key : keys) {
String value = conf.get(getNameServiceIdKey(key, nameserviceId));
if (value != null) {
conf.set(key, value);
}
}
} | [
"public",
"static",
"void",
"setGenericConf",
"(",
"Configuration",
"conf",
",",
"String",
"nameserviceId",
",",
"String",
"...",
"keys",
")",
"{",
"for",
"(",
"String",
"key",
":",
"keys",
")",
"{",
"String",
"value",
"=",
"conf",
".",
"get",
"(",
"getN... | Sets the node specific setting into generic configuration key. Looks up
value of "key.nameserviceId" and if found sets that value into generic key
in the conf. Note that this only modifies the runtime conf.
@param conf
Configuration object to lookup specific key and to set the value
to the key passed. Note the conf ob... | [
"Sets",
"the",
"node",
"specific",
"setting",
"into",
"generic",
"configuration",
"key",
".",
"Looks",
"up",
"value",
"of",
"key",
".",
"nameserviceId",
"and",
"if",
"found",
"sets",
"that",
"value",
"into",
"generic",
"key",
"in",
"the",
"conf",
".",
"Not... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/DFSUtil.java#L863-L871 |
119,504 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/NativeCrc32.java | NativeCrc32.verifyChunkedSums | public static void verifyChunkedSums(int bytesPerSum, int checksumType,
ByteBuffer sums, ByteBuffer data, String fileName, long basePos)
throws ChecksumException {
nativeVerifyChunkedSums(bytesPerSum, checksumType,
sums, sums.position(),
data, data.position(), data.remaining(),
f... | java | public static void verifyChunkedSums(int bytesPerSum, int checksumType,
ByteBuffer sums, ByteBuffer data, String fileName, long basePos)
throws ChecksumException {
nativeVerifyChunkedSums(bytesPerSum, checksumType,
sums, sums.position(),
data, data.position(), data.remaining(),
f... | [
"public",
"static",
"void",
"verifyChunkedSums",
"(",
"int",
"bytesPerSum",
",",
"int",
"checksumType",
",",
"ByteBuffer",
"sums",
",",
"ByteBuffer",
"data",
",",
"String",
"fileName",
",",
"long",
"basePos",
")",
"throws",
"ChecksumException",
"{",
"nativeVerifyC... | Verify the given buffers of data and checksums, and throw an exception
if any checksum is invalid. The buffers given to this function should
have their position initially at the start of the data, and their limit
set at the end of the data. The position, limit, and mark are not
modified.
@param bytesPerSum the chunk s... | [
"Verify",
"the",
"given",
"buffers",
"of",
"data",
"and",
"checksums",
"and",
"throw",
"an",
"exception",
"if",
"any",
"checksum",
"is",
"invalid",
".",
"The",
"buffers",
"given",
"to",
"this",
"function",
"should",
"have",
"their",
"position",
"initially",
... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/NativeCrc32.java#L98-L105 |
119,505 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/ShortWritable.java | ShortWritable.compareTo | @Override
public int compareTo(ShortWritable o) {
short thisValue = this.value;
short thatValue = (o).value;
return (thisValue < thatValue ? -1 : (thisValue == thatValue ? 0 : 1));
} | java | @Override
public int compareTo(ShortWritable o) {
short thisValue = this.value;
short thatValue = (o).value;
return (thisValue < thatValue ? -1 : (thisValue == thatValue ? 0 : 1));
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"ShortWritable",
"o",
")",
"{",
"short",
"thisValue",
"=",
"this",
".",
"value",
";",
"short",
"thatValue",
"=",
"(",
"o",
")",
".",
"value",
";",
"return",
"(",
"thisValue",
"<",
"thatValue",
"?",
"-... | Compares two ShortWritable. | [
"Compares",
"two",
"ShortWritable",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/ShortWritable.java#L79-L84 |
119,506 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/AbstractMapWritable.java | AbstractMapWritable.addToMap | private synchronized void addToMap(Class clazz, byte id) {
if (classToIdMap.containsKey(clazz)) {
byte b = classToIdMap.get(clazz);
if (b != id) {
throw new IllegalArgumentException ("Class " + clazz.getName() +
" already registered but maps to " + b + " and not " + id);
}
}
... | java | private synchronized void addToMap(Class clazz, byte id) {
if (classToIdMap.containsKey(clazz)) {
byte b = classToIdMap.get(clazz);
if (b != id) {
throw new IllegalArgumentException ("Class " + clazz.getName() +
" already registered but maps to " + b + " and not " + id);
}
}
... | [
"private",
"synchronized",
"void",
"addToMap",
"(",
"Class",
"clazz",
",",
"byte",
"id",
")",
"{",
"if",
"(",
"classToIdMap",
".",
"containsKey",
"(",
"clazz",
")",
")",
"{",
"byte",
"b",
"=",
"classToIdMap",
".",
"get",
"(",
"clazz",
")",
";",
"if",
... | Used to add "predefined" classes and by Writable to copy "new" classes. | [
"Used",
"to",
"add",
"predefined",
"classes",
"and",
"by",
"Writable",
"to",
"copy",
"new",
"classes",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/AbstractMapWritable.java#L62-L79 |
119,507 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/AbstractMapWritable.java | AbstractMapWritable.addToMap | protected synchronized void addToMap(Class clazz) {
if (classToIdMap.containsKey(clazz)) {
return;
}
if (newClasses + 1 > Byte.MAX_VALUE) {
throw new IndexOutOfBoundsException("adding an additional class would" +
" exceed the maximum number allowed");
}
byte id = ++newClasses;
... | java | protected synchronized void addToMap(Class clazz) {
if (classToIdMap.containsKey(clazz)) {
return;
}
if (newClasses + 1 > Byte.MAX_VALUE) {
throw new IndexOutOfBoundsException("adding an additional class would" +
" exceed the maximum number allowed");
}
byte id = ++newClasses;
... | [
"protected",
"synchronized",
"void",
"addToMap",
"(",
"Class",
"clazz",
")",
"{",
"if",
"(",
"classToIdMap",
".",
"containsKey",
"(",
"clazz",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"newClasses",
"+",
"1",
">",
"Byte",
".",
"MAX_VALUE",
")",
"{"... | Add a Class to the maps if it is not already present. | [
"Add",
"a",
"Class",
"to",
"the",
"maps",
"if",
"it",
"is",
"not",
"already",
"present",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/AbstractMapWritable.java#L82-L92 |
119,508 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/AbstractMapWritable.java | AbstractMapWritable.copy | protected synchronized void copy(Writable other) {
if (other != null) {
try {
DataOutputBuffer out = new DataOutputBuffer();
other.write(out);
DataInputBuffer in = new DataInputBuffer();
in.reset(out.getData(), out.getLength());
readFields(in);
} catch (I... | java | protected synchronized void copy(Writable other) {
if (other != null) {
try {
DataOutputBuffer out = new DataOutputBuffer();
other.write(out);
DataInputBuffer in = new DataInputBuffer();
in.reset(out.getData(), out.getLength());
readFields(in);
} catch (I... | [
"protected",
"synchronized",
"void",
"copy",
"(",
"Writable",
"other",
")",
"{",
"if",
"(",
"other",
"!=",
"null",
")",
"{",
"try",
"{",
"DataOutputBuffer",
"out",
"=",
"new",
"DataOutputBuffer",
"(",
")",
";",
"other",
".",
"write",
"(",
"out",
")",
"... | Used by child copy constructors. | [
"Used",
"by",
"child",
"copy",
"constructors",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/AbstractMapWritable.java#L105-L122 |
119,509 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/UpgradeObjectDatanode.java | UpgradeObjectDatanode.preUpgradeAction | boolean preUpgradeAction(NamespaceInfo nsInfo) throws IOException {
int nsUpgradeVersion = nsInfo.getDistributedUpgradeVersion();
if(nsUpgradeVersion >= getVersion())
return false; // name-node will perform the upgrade
// Missed the upgrade. Report problem to the name-node and throw exception
Stri... | java | boolean preUpgradeAction(NamespaceInfo nsInfo) throws IOException {
int nsUpgradeVersion = nsInfo.getDistributedUpgradeVersion();
if(nsUpgradeVersion >= getVersion())
return false; // name-node will perform the upgrade
// Missed the upgrade. Report problem to the name-node and throw exception
Stri... | [
"boolean",
"preUpgradeAction",
"(",
"NamespaceInfo",
"nsInfo",
")",
"throws",
"IOException",
"{",
"int",
"nsUpgradeVersion",
"=",
"nsInfo",
".",
"getDistributedUpgradeVersion",
"(",
")",
";",
"if",
"(",
"nsUpgradeVersion",
">=",
"getVersion",
"(",
")",
")",
"retur... | Specifies what to do before the upgrade is started.
The default implementation checks whether the data-node missed the upgrade
and throws an exception if it did. This leads to the data-node shutdown.
Data-nodes usually start distributed upgrade when the name-node replies
to its heartbeat with a start upgrade command.... | [
"Specifies",
"what",
"to",
"do",
"before",
"the",
"upgrade",
"is",
"started",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/UpgradeObjectDatanode.java#L77-L96 |
119,510 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java | BlocksMap.removeBlockFromMap | private BlockInfo removeBlockFromMap(Block b) {
if (b == null) {
return null;
}
ns.decrementSafeBlockCountForBlockRemoval(b);
return blocks.remove(b);
} | java | private BlockInfo removeBlockFromMap(Block b) {
if (b == null) {
return null;
}
ns.decrementSafeBlockCountForBlockRemoval(b);
return blocks.remove(b);
} | [
"private",
"BlockInfo",
"removeBlockFromMap",
"(",
"Block",
"b",
")",
"{",
"if",
"(",
"b",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"ns",
".",
"decrementSafeBlockCountForBlockRemoval",
"(",
"b",
")",
";",
"return",
"blocks",
".",
"remove",
"(",
... | All removals from the blocks map goes through this function.
@param b
block to be removed
@param decrementSafeBlockCount
whether need to decrement safe block count when needed
@return the {@link BlockInfo} for the removed block | [
"All",
"removals",
"from",
"the",
"blocks",
"map",
"goes",
"through",
"this",
"function",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L380-L386 |
119,511 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java | BlocksMap.addINode | BlockInfo addINode(Block b, INodeFile iNode, short replication) {
BlockInfo info = checkBlockInfo(b, replication);
info.inode = iNode;
return info;
} | java | BlockInfo addINode(Block b, INodeFile iNode, short replication) {
BlockInfo info = checkBlockInfo(b, replication);
info.inode = iNode;
return info;
} | [
"BlockInfo",
"addINode",
"(",
"Block",
"b",
",",
"INodeFile",
"iNode",
",",
"short",
"replication",
")",
"{",
"BlockInfo",
"info",
"=",
"checkBlockInfo",
"(",
"b",
",",
"replication",
")",
";",
"info",
".",
"inode",
"=",
"iNode",
";",
"return",
"info",
"... | Add block b belonging to the specified file inode to the map | [
"Add",
"block",
"b",
"belonging",
"to",
"the",
"specified",
"file",
"inode",
"to",
"the",
"map"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L425-L429 |
119,512 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java | BlocksMap.addINodeForLoading | BlockInfo addINodeForLoading(Block b, INodeFile iNode) {
// allocate new block when loading the image
// for hardlinked files, we need to check if the blocks are already there
BlockInfo info = checkBlockInfo(b, iNode.getReplication(),
iNode.isHardlinkFile());
info.inode = iNode;
return info;... | java | BlockInfo addINodeForLoading(Block b, INodeFile iNode) {
// allocate new block when loading the image
// for hardlinked files, we need to check if the blocks are already there
BlockInfo info = checkBlockInfo(b, iNode.getReplication(),
iNode.isHardlinkFile());
info.inode = iNode;
return info;... | [
"BlockInfo",
"addINodeForLoading",
"(",
"Block",
"b",
",",
"INodeFile",
"iNode",
")",
"{",
"// allocate new block when loading the image",
"// for hardlinked files, we need to check if the blocks are already there",
"BlockInfo",
"info",
"=",
"checkBlockInfo",
"(",
"b",
",",
"iN... | Add block b belonging to the specified file inode to the map.
Does not check for block existence, for non-hardlinked files. | [
"Add",
"block",
"b",
"belonging",
"to",
"the",
"specified",
"file",
"inode",
"to",
"the",
"map",
".",
"Does",
"not",
"check",
"for",
"block",
"existence",
"for",
"non",
"-",
"hardlinked",
"files",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L435-L442 |
119,513 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java | BlocksMap.updateINode | public BlockInfo updateINode(BlockInfo oldBlock, Block newBlock, INodeFile iNode,
short replication, boolean forceUpdate) throws IOException {
// If the old block is not same as the new block, probably the GS was
// bumped up, hence update the block with new GS/size.
// If forceUpdate is true, we will... | java | public BlockInfo updateINode(BlockInfo oldBlock, Block newBlock, INodeFile iNode,
short replication, boolean forceUpdate) throws IOException {
// If the old block is not same as the new block, probably the GS was
// bumped up, hence update the block with new GS/size.
// If forceUpdate is true, we will... | [
"public",
"BlockInfo",
"updateINode",
"(",
"BlockInfo",
"oldBlock",
",",
"Block",
"newBlock",
",",
"INodeFile",
"iNode",
",",
"short",
"replication",
",",
"boolean",
"forceUpdate",
")",
"throws",
"IOException",
"{",
"// If the old block is not same as the new block, proba... | Add block b belonging to the specified file inode to the map, this
overwrites the map with the new block information. | [
"Add",
"block",
"b",
"belonging",
"to",
"the",
"specified",
"file",
"inode",
"to",
"the",
"map",
"this",
"overwrites",
"the",
"map",
"with",
"the",
"new",
"block",
"information",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L448-L487 |
119,514 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java | BlocksMap.removeINode | void removeINode(Block b) {
BlockInfo info = blocks.get(b);
if (info != null) {
info.inode = null;
if (info.getDatanode(0) == null) { // no datanodes left
removeBlockFromMap(b); // remove block from the map
}
}
} | java | void removeINode(Block b) {
BlockInfo info = blocks.get(b);
if (info != null) {
info.inode = null;
if (info.getDatanode(0) == null) { // no datanodes left
removeBlockFromMap(b); // remove block from the map
}
}
} | [
"void",
"removeINode",
"(",
"Block",
"b",
")",
"{",
"BlockInfo",
"info",
"=",
"blocks",
".",
"get",
"(",
"b",
")",
";",
"if",
"(",
"info",
"!=",
"null",
")",
"{",
"info",
".",
"inode",
"=",
"null",
";",
"if",
"(",
"info",
".",
"getDatanode",
"(",... | Remove INode reference from block b.
If it does not belong to any file and data-nodes,
then remove the block from the block map. | [
"Remove",
"INode",
"reference",
"from",
"block",
"b",
".",
"If",
"it",
"does",
"not",
"belong",
"to",
"any",
"file",
"and",
"data",
"-",
"nodes",
"then",
"remove",
"the",
"block",
"from",
"the",
"block",
"map",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L494-L502 |
119,515 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java | BlocksMap.removeBlock | void removeBlock(Block block) {
BlockInfo blockInfo = removeBlockFromMap(block);
if (blockInfo == null)
return;
blockInfo.inode = null;
for(int idx = blockInfo.numNodes()-1; idx >= 0; idx--) {
DatanodeDescriptor dn = blockInfo.getDatanode(idx);
dn.removeBlock(blockInfo); // remove from... | java | void removeBlock(Block block) {
BlockInfo blockInfo = removeBlockFromMap(block);
if (blockInfo == null)
return;
blockInfo.inode = null;
for(int idx = blockInfo.numNodes()-1; idx >= 0; idx--) {
DatanodeDescriptor dn = blockInfo.getDatanode(idx);
dn.removeBlock(blockInfo); // remove from... | [
"void",
"removeBlock",
"(",
"Block",
"block",
")",
"{",
"BlockInfo",
"blockInfo",
"=",
"removeBlockFromMap",
"(",
"block",
")",
";",
"if",
"(",
"blockInfo",
"==",
"null",
")",
"return",
";",
"blockInfo",
".",
"inode",
"=",
"null",
";",
"for",
"(",
"int",... | Remove the block from the block map;
remove it from all data-node lists it belongs to;
and remove all data-node locations associated with the block. | [
"Remove",
"the",
"block",
"from",
"the",
"block",
"map",
";",
"remove",
"it",
"from",
"all",
"data",
"-",
"node",
"lists",
"it",
"belongs",
"to",
";",
"and",
"remove",
"all",
"data",
"-",
"node",
"locations",
"associated",
"with",
"the",
"block",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L509-L518 |
119,516 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java | BlocksMap.numNodes | int numNodes(Block b) {
BlockInfo info = blocks.get(b);
return info == null ? 0 : info.numNodes();
} | java | int numNodes(Block b) {
BlockInfo info = blocks.get(b);
return info == null ? 0 : info.numNodes();
} | [
"int",
"numNodes",
"(",
"Block",
"b",
")",
"{",
"BlockInfo",
"info",
"=",
"blocks",
".",
"get",
"(",
"b",
")",
";",
"return",
"info",
"==",
"null",
"?",
"0",
":",
"info",
".",
"numNodes",
"(",
")",
";",
"}"
] | counts number of containing nodes. Better than using iterator. | [
"counts",
"number",
"of",
"containing",
"nodes",
".",
"Better",
"than",
"using",
"iterator",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L536-L539 |
119,517 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java | BlocksMap.addNode | boolean addNode(Block b, DatanodeDescriptor node, int replication) {
// insert into the map if not there yet
BlockInfo info = checkBlockInfo(b, replication);
// add block to the data-node list and the node to the block info
return node.addBlock(info);
} | java | boolean addNode(Block b, DatanodeDescriptor node, int replication) {
// insert into the map if not there yet
BlockInfo info = checkBlockInfo(b, replication);
// add block to the data-node list and the node to the block info
return node.addBlock(info);
} | [
"boolean",
"addNode",
"(",
"Block",
"b",
",",
"DatanodeDescriptor",
"node",
",",
"int",
"replication",
")",
"{",
"// insert into the map if not there yet",
"BlockInfo",
"info",
"=",
"checkBlockInfo",
"(",
"b",
",",
"replication",
")",
";",
"// add block to the data-no... | returns true if the node does not already exists and is added.
false if the node already exists. | [
"returns",
"true",
"if",
"the",
"node",
"does",
"not",
"already",
"exists",
"and",
"is",
"added",
".",
"false",
"if",
"the",
"node",
"already",
"exists",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L543-L548 |
119,518 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java | BlocksMap.removeNode | boolean removeNode(Block b, DatanodeDescriptor node) {
BlockInfo info = blocks.get(b);
if (info == null)
return false;
// remove block from the data-node list and the node from the block info
boolean removed = node.removeBlock(info);
if (info.getDatanode(0) == null // no datanodes left
... | java | boolean removeNode(Block b, DatanodeDescriptor node) {
BlockInfo info = blocks.get(b);
if (info == null)
return false;
// remove block from the data-node list and the node from the block info
boolean removed = node.removeBlock(info);
if (info.getDatanode(0) == null // no datanodes left
... | [
"boolean",
"removeNode",
"(",
"Block",
"b",
",",
"DatanodeDescriptor",
"node",
")",
"{",
"BlockInfo",
"info",
"=",
"blocks",
".",
"get",
"(",
"b",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"false",
";",
"// remove block from the data-node lis... | Remove data-node reference from the block.
Remove the block from the block map
only if it does not belong to any file and data-nodes. | [
"Remove",
"data",
"-",
"node",
"reference",
"from",
"the",
"block",
".",
"Remove",
"the",
"block",
"from",
"the",
"block",
"map",
"only",
"if",
"it",
"does",
"not",
"belong",
"to",
"any",
"file",
"and",
"data",
"-",
"nodes",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L555-L568 |
119,519 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java | BlocksMap.getBlocksIterarors | List<Iterator<BlockInfo>> getBlocksIterarors(int numShards) {
List<Iterator<BlockInfo>> iterators = new ArrayList<Iterator<BlockInfo>>();
if (numShards <= 0) {
throw new IllegalArgumentException("Number of shards must be greater than 0");
}
for (int i = 0; i < numShards; i++) {
Iterator<Bloc... | java | List<Iterator<BlockInfo>> getBlocksIterarors(int numShards) {
List<Iterator<BlockInfo>> iterators = new ArrayList<Iterator<BlockInfo>>();
if (numShards <= 0) {
throw new IllegalArgumentException("Number of shards must be greater than 0");
}
for (int i = 0; i < numShards; i++) {
Iterator<Bloc... | [
"List",
"<",
"Iterator",
"<",
"BlockInfo",
">",
">",
"getBlocksIterarors",
"(",
"int",
"numShards",
")",
"{",
"List",
"<",
"Iterator",
"<",
"BlockInfo",
">>",
"iterators",
"=",
"new",
"ArrayList",
"<",
"Iterator",
"<",
"BlockInfo",
">",
">",
"(",
")",
";... | Get a list of shard iterators. Each iterator will travers only a part
of the blocks map.
@param numShards desired number of shards
@return list of iterators (size might be smaller than
numShards if blocks map has fewer buckets) | [
"Get",
"a",
"list",
"of",
"shard",
"iterators",
".",
"Each",
"iterator",
"will",
"travers",
"only",
"a",
"part",
"of",
"the",
"blocks",
"map",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L585-L597 |
119,520 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java | BlocksMap.contains | boolean contains(Block block, DatanodeDescriptor datanode) {
BlockInfo info = blocks.get(block);
if (info == null)
return false;
if (-1 == info.findDatanode(datanode))
return false;
return true;
} | java | boolean contains(Block block, DatanodeDescriptor datanode) {
BlockInfo info = blocks.get(block);
if (info == null)
return false;
if (-1 == info.findDatanode(datanode))
return false;
return true;
} | [
"boolean",
"contains",
"(",
"Block",
"block",
",",
"DatanodeDescriptor",
"datanode",
")",
"{",
"BlockInfo",
"info",
"=",
"blocks",
".",
"get",
"(",
"block",
")",
";",
"if",
"(",
"info",
"==",
"null",
")",
"return",
"false",
";",
"if",
"(",
"-",
"1",
... | Check if the replica at the given datanode exists in map | [
"Check",
"if",
"the",
"replica",
"at",
"the",
"given",
"datanode",
"exists",
"in",
"map"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/BlocksMap.java#L608-L617 |
119,521 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImagePreTransactionalStorageInspector.java | FSImagePreTransactionalStorageInspector.readCheckpointTime | static long readCheckpointTime(StorageDirectory sd) throws IOException {
File timeFile = NNStorage.getStorageFile(sd, NameNodeFile.TIME);
long timeStamp = 0L;
if (timeFile.exists() && timeFile.canRead()) {
DataInputStream in = new DataInputStream(new FileInputStream(timeFile));
try {
tim... | java | static long readCheckpointTime(StorageDirectory sd) throws IOException {
File timeFile = NNStorage.getStorageFile(sd, NameNodeFile.TIME);
long timeStamp = 0L;
if (timeFile.exists() && timeFile.canRead()) {
DataInputStream in = new DataInputStream(new FileInputStream(timeFile));
try {
tim... | [
"static",
"long",
"readCheckpointTime",
"(",
"StorageDirectory",
"sd",
")",
"throws",
"IOException",
"{",
"File",
"timeFile",
"=",
"NNStorage",
".",
"getStorageFile",
"(",
"sd",
",",
"NameNodeFile",
".",
"TIME",
")",
";",
"long",
"timeStamp",
"=",
"0L",
";",
... | Determine the checkpoint time of the specified StorageDirectory
@param sd StorageDirectory to check
@return If file exists and can be read, last checkpoint time. If not, 0L.
@throws IOException On errors processing file pointed to by sd | [
"Determine",
"the",
"checkpoint",
"time",
"of",
"the",
"specified",
"StorageDirectory"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/FSImagePreTransactionalStorageInspector.java#L145-L157 |
119,522 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/LimitTasksPerJobTaskScheduler.java | LimitTasksPerJobTaskScheduler.getMaxMapAndReduceLoad | protected synchronized int[] getMaxMapAndReduceLoad(int localMaxMapLoad,
int localMaxReduceLoad) {
// Approximate because of concurrency
final int numTaskTrackers =
taskTrackerManager.getClusterStatus().getTaskTrackers();
/* Hold the result */
int maxMapLoad = 0;
int maxReduceLoad = 0;
... | java | protected synchronized int[] getMaxMapAndReduceLoad(int localMaxMapLoad,
int localMaxReduceLoad) {
// Approximate because of concurrency
final int numTaskTrackers =
taskTrackerManager.getClusterStatus().getTaskTrackers();
/* Hold the result */
int maxMapLoad = 0;
int maxReduceLoad = 0;
... | [
"protected",
"synchronized",
"int",
"[",
"]",
"getMaxMapAndReduceLoad",
"(",
"int",
"localMaxMapLoad",
",",
"int",
"localMaxReduceLoad",
")",
"{",
"// Approximate because of concurrency",
"final",
"int",
"numTaskTrackers",
"=",
"taskTrackerManager",
".",
"getClusterStatus",... | Determine the maximum number of maps or reduces that we are willing to run
on a taskTracker which accept a maximum of localMaxMapLoad maps and
localMaxReduceLoad reduces
@param localMaxMapLoad The local maximum number of map tasks for a host
@param localMaxReduceLoad The local maximum number of reduce tasks for a
host
... | [
"Determine",
"the",
"maximum",
"number",
"of",
"maps",
"or",
"reduces",
"that",
"we",
"are",
"willing",
"to",
"run",
"on",
"a",
"taskTracker",
"which",
"accept",
"a",
"maximum",
"of",
"localMaxMapLoad",
"maps",
"and",
"localMaxReduceLoad",
"reduces"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/LimitTasksPerJobTaskScheduler.java#L171-L198 |
119,523 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/util/MetricsRegistry.java | MetricsRegistry.add | public void add(final String metricsName, final MetricsBase theMetricsObj) {
if (metricsList.putIfAbsent(metricsName, theMetricsObj) != null) {
throw new IllegalArgumentException("Duplicate metricsName:" + metricsName);
}
} | java | public void add(final String metricsName, final MetricsBase theMetricsObj) {
if (metricsList.putIfAbsent(metricsName, theMetricsObj) != null) {
throw new IllegalArgumentException("Duplicate metricsName:" + metricsName);
}
} | [
"public",
"void",
"add",
"(",
"final",
"String",
"metricsName",
",",
"final",
"MetricsBase",
"theMetricsObj",
")",
"{",
"if",
"(",
"metricsList",
".",
"putIfAbsent",
"(",
"metricsName",
",",
"theMetricsObj",
")",
"!=",
"null",
")",
"{",
"throw",
"new",
"Ille... | Add a new metrics to the registry
@param metricsName - the name
@param theMetricsObj - the metrics
@throws IllegalArgumentException if a name is already registered | [
"Add",
"a",
"new",
"metrics",
"to",
"the",
"registry"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/util/MetricsRegistry.java#L51-L55 |
119,524 | facebookarchive/hadoop-20 | src/examples/org/apache/hadoop/examples/PiEstimator.java | PiEstimator.main | public static void main(String[] argv) throws Exception {
System.exit(ToolRunner.run(null, new PiEstimator(), argv));
} | java | public static void main(String[] argv) throws Exception {
System.exit(ToolRunner.run(null, new PiEstimator(), argv));
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"argv",
")",
"throws",
"Exception",
"{",
"System",
".",
"exit",
"(",
"ToolRunner",
".",
"run",
"(",
"null",
",",
"new",
"PiEstimator",
"(",
")",
",",
"argv",
")",
")",
";",
"}"
] | main method for running it as a stand alone command. | [
"main",
"method",
"for",
"running",
"it",
"as",
"a",
"stand",
"alone",
"command",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/examples/org/apache/hadoop/examples/PiEstimator.java#L350-L352 |
119,525 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FileStatus.java | FileStatus.compareTo | public int compareTo(Object o) {
FileStatus other = (FileStatus)o;
return this.getPath().compareTo(other.getPath());
} | java | public int compareTo(Object o) {
FileStatus other = (FileStatus)o;
return this.getPath().compareTo(other.getPath());
} | [
"public",
"int",
"compareTo",
"(",
"Object",
"o",
")",
"{",
"FileStatus",
"other",
"=",
"(",
"FileStatus",
")",
"o",
";",
"return",
"this",
".",
"getPath",
"(",
")",
".",
"compareTo",
"(",
"other",
".",
"getPath",
"(",
")",
")",
";",
"}"
] | Compare this object to another object
@param o the object to be compared.
@return a negative integer, zero, or a positive integer as this object
is less than, equal to, or greater than the specified object.
@throws ClassCastException if the specified object's is not of
type FileStatus | [
"Compare",
"this",
"object",
"to",
"another",
"object"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FileStatus.java#L282-L285 |
119,526 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapreduce/JobID.java | JobID.compareTo | @Override
public int compareTo(ID o) {
JobID that = (JobID)o;
int jtComp = this.jtIdentifier.compareTo(that.jtIdentifier);
if(jtComp == 0) {
return this.id - that.id;
}
else return jtComp;
} | java | @Override
public int compareTo(ID o) {
JobID that = (JobID)o;
int jtComp = this.jtIdentifier.compareTo(that.jtIdentifier);
if(jtComp == 0) {
return this.id - that.id;
}
else return jtComp;
} | [
"@",
"Override",
"public",
"int",
"compareTo",
"(",
"ID",
"o",
")",
"{",
"JobID",
"that",
"=",
"(",
"JobID",
")",
"o",
";",
"int",
"jtComp",
"=",
"this",
".",
"jtIdentifier",
".",
"compareTo",
"(",
"that",
".",
"jtIdentifier",
")",
";",
"if",
"(",
... | Compare JobIds by first jtIdentifiers, then by job numbers | [
"Compare",
"JobIds",
"by",
"first",
"jtIdentifiers",
"then",
"by",
"job",
"numbers"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/JobID.java#L86-L94 |
119,527 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapreduce/JobID.java | JobID.appendTo | public StringBuilder appendTo(StringBuilder builder) {
builder.append(SEPARATOR);
builder.append(jtIdentifier);
builder.append(SEPARATOR);
builder.append(idFormat.format(id));
return builder;
} | java | public StringBuilder appendTo(StringBuilder builder) {
builder.append(SEPARATOR);
builder.append(jtIdentifier);
builder.append(SEPARATOR);
builder.append(idFormat.format(id));
return builder;
} | [
"public",
"StringBuilder",
"appendTo",
"(",
"StringBuilder",
"builder",
")",
"{",
"builder",
".",
"append",
"(",
"SEPARATOR",
")",
";",
"builder",
".",
"append",
"(",
"jtIdentifier",
")",
";",
"builder",
".",
"append",
"(",
"SEPARATOR",
")",
";",
"builder",
... | Add the stuff after the "job" prefix to the given builder. This is useful,
because the sub-ids use this substring at the start of their string.
@param builder the builder to append to
@return the builder that was passed in | [
"Add",
"the",
"stuff",
"after",
"the",
"job",
"prefix",
"to",
"the",
"given",
"builder",
".",
"This",
"is",
"useful",
"because",
"the",
"sub",
"-",
"ids",
"use",
"this",
"substring",
"at",
"the",
"start",
"of",
"their",
"string",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapreduce/JobID.java#L102-L108 |
119,528 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java | JspHelper.bestNode | public DatanodeInfo[] bestNode(LocatedBlocks blks) throws IOException {
// insert all known replica locations into a tree map where the
// key is the DatanodeInfo
TreeMap<DatanodeInfo, NodeRecord> map =
new TreeMap<DatanodeInfo, NodeRecord>();
for (int i = 0; i < blks.getLocatedBlocks().size(); i... | java | public DatanodeInfo[] bestNode(LocatedBlocks blks) throws IOException {
// insert all known replica locations into a tree map where the
// key is the DatanodeInfo
TreeMap<DatanodeInfo, NodeRecord> map =
new TreeMap<DatanodeInfo, NodeRecord>();
for (int i = 0; i < blks.getLocatedBlocks().size(); i... | [
"public",
"DatanodeInfo",
"[",
"]",
"bestNode",
"(",
"LocatedBlocks",
"blks",
")",
"throws",
"IOException",
"{",
"// insert all known replica locations into a tree map where the",
"// key is the DatanodeInfo",
"TreeMap",
"<",
"DatanodeInfo",
",",
"NodeRecord",
">",
"map",
"... | Get an array of nodes that can serve the streaming request
The best one is the first in the array which has maximum
local copies of all blocks | [
"Get",
"an",
"array",
"of",
"nodes",
"that",
"can",
"serve",
"the",
"streaming",
"request",
"The",
"best",
"one",
"is",
"the",
"first",
"in",
"the",
"array",
"which",
"has",
"maximum",
"local",
"copies",
"of",
"all",
"blocks"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java#L117-L144 |
119,529 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java | JspHelper.bestNode | public static DatanodeInfo bestNode(LocatedBlock blk) throws IOException {
DatanodeInfo [] nodes = blk.getLocations();
return bestNode(nodes, true).get(0);
} | java | public static DatanodeInfo bestNode(LocatedBlock blk) throws IOException {
DatanodeInfo [] nodes = blk.getLocations();
return bestNode(nodes, true).get(0);
} | [
"public",
"static",
"DatanodeInfo",
"bestNode",
"(",
"LocatedBlock",
"blk",
")",
"throws",
"IOException",
"{",
"DatanodeInfo",
"[",
"]",
"nodes",
"=",
"blk",
".",
"getLocations",
"(",
")",
";",
"return",
"bestNode",
"(",
"nodes",
",",
"true",
")",
".",
"ge... | return a random node from the replicas of this block | [
"return",
"a",
"random",
"node",
"from",
"the",
"replicas",
"of",
"this",
"block"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java#L149-L152 |
119,530 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java | JspHelper.bestNode | public static <T extends DatanodeID> List<T> bestNode(T[] nodes, boolean doRandom)
throws IOException {
TreeSet<T> deadNodes = new TreeSet<T>();
T chosenNode = null;
int failures = 0;
Socket s = null;
int index = -1;
if (nodes == null || nodes.length == 0) {
throw new IOException("No ... | java | public static <T extends DatanodeID> List<T> bestNode(T[] nodes, boolean doRandom)
throws IOException {
TreeSet<T> deadNodes = new TreeSet<T>();
T chosenNode = null;
int failures = 0;
Socket s = null;
int index = -1;
if (nodes == null || nodes.length == 0) {
throw new IOException("No ... | [
"public",
"static",
"<",
"T",
"extends",
"DatanodeID",
">",
"List",
"<",
"T",
">",
"bestNode",
"(",
"T",
"[",
"]",
"nodes",
",",
"boolean",
"doRandom",
")",
"throws",
"IOException",
"{",
"TreeSet",
"<",
"T",
">",
"deadNodes",
"=",
"new",
"TreeSet",
"<"... | Choose a list datanodes from the specified list. The best one is
the first one in the list.
If doRamdom is true, then
a random datanode is selected. Otherwise, a node that appears earlier
in the list has more probability of being selected | [
"Choose",
"a",
"list",
"datanodes",
"from",
"the",
"specified",
"list",
".",
"The",
"best",
"one",
"is",
"the",
"first",
"one",
"in",
"the",
"list",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java#L162-L219 |
119,531 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java | JspHelper.getUrlParam | public static String getUrlParam(String name, String val) {
return val == null ? "" : "&" + name + "=" + val;
} | java | public static String getUrlParam(String name, String val) {
return val == null ? "" : "&" + name + "=" + val;
} | [
"public",
"static",
"String",
"getUrlParam",
"(",
"String",
"name",
",",
"String",
"val",
")",
"{",
"return",
"val",
"==",
"null",
"?",
"\"\"",
":",
"\"&\"",
"+",
"name",
"+",
"\"=\"",
"+",
"val",
";",
"}"
] | Returns the url parameter for the given bpid string.
@param name parameter name
@param val parameter value
@return url parameter | [
"Returns",
"the",
"url",
"parameter",
"for",
"the",
"given",
"bpid",
"string",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java#L573-L575 |
119,532 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java | JspHelper.getDFSClient | public static DFSClient getDFSClient(final HttpServletRequest request,
final Configuration conf) throws IOException, InterruptedException {
final String nnAddr = request.getParameter(JspHelper.NAMENODE_ADDRESS);
return new DFSClient(DFSUtil.getSocketAddress(nnAddr), conf);
} | java | public static DFSClient getDFSClient(final HttpServletRequest request,
final Configuration conf) throws IOException, InterruptedException {
final String nnAddr = request.getParameter(JspHelper.NAMENODE_ADDRESS);
return new DFSClient(DFSUtil.getSocketAddress(nnAddr), conf);
} | [
"public",
"static",
"DFSClient",
"getDFSClient",
"(",
"final",
"HttpServletRequest",
"request",
",",
"final",
"Configuration",
"conf",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"final",
"String",
"nnAddr",
"=",
"request",
".",
"getParameter",
"... | Get DFSClient for a namenode corresponding to the BPID from a datanode | [
"Get",
"DFSClient",
"for",
"a",
"namenode",
"corresponding",
"to",
"the",
"BPID",
"from",
"a",
"datanode"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/JspHelper.java#L578-L582 |
119,533 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/lib/IdentityReducer.java | IdentityReducer.reduce | public void reduce(K key, Iterator<V> values,
OutputCollector<K, V> output, Reporter reporter)
throws IOException {
while (values.hasNext()) {
output.collect(key, values.next());
}
} | java | public void reduce(K key, Iterator<V> values,
OutputCollector<K, V> output, Reporter reporter)
throws IOException {
while (values.hasNext()) {
output.collect(key, values.next());
}
} | [
"public",
"void",
"reduce",
"(",
"K",
"key",
",",
"Iterator",
"<",
"V",
">",
"values",
",",
"OutputCollector",
"<",
"K",
",",
"V",
">",
"output",
",",
"Reporter",
"reporter",
")",
"throws",
"IOException",
"{",
"while",
"(",
"values",
".",
"hasNext",
"(... | Writes all keys and values directly to output. | [
"Writes",
"all",
"keys",
"and",
"values",
"directly",
"to",
"output",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/IdentityReducer.java#L38-L44 |
119,534 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaAdmin.java | CoronaAdmin.restartTaskTracker | private int restartTaskTracker(boolean forceFlag, int batchSize) throws IOException {
// Get the current configuration
CoronaConf conf = new CoronaConf(getConf());
InetSocketAddress address = NetUtils.createSocketAddr(conf
.getClusterManagerAddress());
TFramedTransport transport = new TFramedTr... | java | private int restartTaskTracker(boolean forceFlag, int batchSize) throws IOException {
// Get the current configuration
CoronaConf conf = new CoronaConf(getConf());
InetSocketAddress address = NetUtils.createSocketAddr(conf
.getClusterManagerAddress());
TFramedTransport transport = new TFramedTr... | [
"private",
"int",
"restartTaskTracker",
"(",
"boolean",
"forceFlag",
",",
"int",
"batchSize",
")",
"throws",
"IOException",
"{",
"// Get the current configuration",
"CoronaConf",
"conf",
"=",
"new",
"CoronaConf",
"(",
"getConf",
"(",
")",
")",
";",
"InetSocketAddres... | Command to ask the Cluster Manager to restart all the task tracker
@param forceFlag if CM shall ignore all previous restart requests
@exception IOException
@return Returns 0 where no exception is thrown. | [
"Command",
"to",
"ask",
"the",
"Cluster",
"Manager",
"to",
"restart",
"all",
"the",
"task",
"tracker"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaAdmin.java#L105-L130 |
119,535 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaAdmin.java | CoronaAdmin.setSafeMode | private int setSafeMode(boolean safeMode) throws IOException {
// Get the current configuration
CoronaConf conf = new CoronaConf(getConf());
InetSocketAddress address = NetUtils.createSocketAddr(conf
.getClusterManagerAddress());
TFramedTransport transport = new TFramedTransport(
new TSocke... | java | private int setSafeMode(boolean safeMode) throws IOException {
// Get the current configuration
CoronaConf conf = new CoronaConf(getConf());
InetSocketAddress address = NetUtils.createSocketAddr(conf
.getClusterManagerAddress());
TFramedTransport transport = new TFramedTransport(
new TSocke... | [
"private",
"int",
"setSafeMode",
"(",
"boolean",
"safeMode",
")",
"throws",
"IOException",
"{",
"// Get the current configuration",
"CoronaConf",
"conf",
"=",
"new",
"CoronaConf",
"(",
"getConf",
"(",
")",
")",
";",
"InetSocketAddress",
"address",
"=",
"NetUtils",
... | Turns on the Safe Mode if safeMode is true. Turns off the Safe Mode if
safeMode is false.
@param safeMode Is true if we want the Safe Mode to be on. false
otherwise.
@return 0 if successful.
@throws IOException | [
"Turns",
"on",
"the",
"Safe",
"Mode",
"if",
"safeMode",
"is",
"true",
".",
"Turns",
"off",
"the",
"Safe",
"Mode",
"if",
"safeMode",
"is",
"false",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaAdmin.java#L140-L164 |
119,536 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaAdmin.java | CoronaAdmin.forceSetSafeModeOnPJT | private int forceSetSafeModeOnPJT(boolean safeMode) throws IOException {
CoronaConf conf = new CoronaConf(getConf());
try {
ClusterManagerAvailabilityChecker.getPJTClient(conf).
setClusterManagerSafeModeFlag(safeMode);
} catch (IOException e) {
System.err.println("Could not set the Safe ... | java | private int forceSetSafeModeOnPJT(boolean safeMode) throws IOException {
CoronaConf conf = new CoronaConf(getConf());
try {
ClusterManagerAvailabilityChecker.getPJTClient(conf).
setClusterManagerSafeModeFlag(safeMode);
} catch (IOException e) {
System.err.println("Could not set the Safe ... | [
"private",
"int",
"forceSetSafeModeOnPJT",
"(",
"boolean",
"safeMode",
")",
"throws",
"IOException",
"{",
"CoronaConf",
"conf",
"=",
"new",
"CoronaConf",
"(",
"getConf",
"(",
")",
")",
";",
"try",
"{",
"ClusterManagerAvailabilityChecker",
".",
"getPJTClient",
"(",... | Forcefully set the Safe Mode on the PJT
@return 0 if successful
@throws IOException | [
"Forcefully",
"set",
"the",
"Safe",
"Mode",
"on",
"the",
"PJT"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaAdmin.java#L199-L210 |
119,537 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaAdmin.java | CoronaAdmin.main | public static void main(String[] args) throws Exception {
int result = ToolRunner.run(new CoronaAdmin(), args);
System.exit(result);
} | java | public static void main(String[] args) throws Exception {
int result = ToolRunner.run(new CoronaAdmin(), args);
System.exit(result);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"int",
"result",
"=",
"ToolRunner",
".",
"run",
"(",
"new",
"CoronaAdmin",
"(",
")",
",",
"args",
")",
";",
"System",
".",
"exit",
"(",
"result",
")... | Entry point for the tool.
@param args
The command line arguments.
@throws Exception | [
"Entry",
"point",
"for",
"the",
"tool",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/CoronaAdmin.java#L280-L283 |
119,538 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/mapred/ProxyJobTracker.java | ProxyJobTracker.urlInJobHistory | public static String urlInJobHistory(
Path jobHistoryFileLocation, String jobId)
throws IOException {
try {
FileSystem fs = jobHistoryFileLocation.getFileSystem(conf);
fs.getFileStatus(jobHistoryFileLocation);
} catch (FileNotFoundException e) {
return null;
}
return "http://"... | java | public static String urlInJobHistory(
Path jobHistoryFileLocation, String jobId)
throws IOException {
try {
FileSystem fs = jobHistoryFileLocation.getFileSystem(conf);
fs.getFileStatus(jobHistoryFileLocation);
} catch (FileNotFoundException e) {
return null;
}
return "http://"... | [
"public",
"static",
"String",
"urlInJobHistory",
"(",
"Path",
"jobHistoryFileLocation",
",",
"String",
"jobId",
")",
"throws",
"IOException",
"{",
"try",
"{",
"FileSystem",
"fs",
"=",
"jobHistoryFileLocation",
".",
"getFileSystem",
"(",
"conf",
")",
";",
"fs",
"... | Given the path to the jobHistoryFile, check if the file already exists.
1. If FileNoFoundException is caught, means the job is not yet finished,
and there is not job hisotry log file in the done directory
2. If not, it means we get a hit for the jobHistoryFile, directly recover
the url to the coronoajobdetailshistory p... | [
"Given",
"the",
"path",
"to",
"the",
"jobHistoryFile",
"check",
"if",
"the",
"file",
"already",
"exists",
".",
"1",
".",
"If",
"FileNoFoundException",
"is",
"caught",
"means",
"the",
"job",
"is",
"not",
"yet",
"finished",
"and",
"there",
"is",
"not",
"job"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/mapred/ProxyJobTracker.java#L779-L791 |
119,539 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/lib/aggregate/ValueHistogram.java | ValueHistogram.addNextValue | public void addNextValue(Object val) {
String valCountStr = val.toString();
int pos = valCountStr.lastIndexOf("\t");
String valStr = valCountStr;
String countStr = "1";
if (pos >= 0) {
valStr = valCountStr.substring(0, pos);
countStr = valCountStr.substring(pos + 1);
}
Long ... | java | public void addNextValue(Object val) {
String valCountStr = val.toString();
int pos = valCountStr.lastIndexOf("\t");
String valStr = valCountStr;
String countStr = "1";
if (pos >= 0) {
valStr = valCountStr.substring(0, pos);
countStr = valCountStr.substring(pos + 1);
}
Long ... | [
"public",
"void",
"addNextValue",
"(",
"Object",
"val",
")",
"{",
"String",
"valCountStr",
"=",
"val",
".",
"toString",
"(",
")",
";",
"int",
"pos",
"=",
"valCountStr",
".",
"lastIndexOf",
"(",
"\"\\t\"",
")",
";",
"String",
"valStr",
"=",
"valCountStr",
... | add the given val to the aggregator.
@param val the value to be added. It is expected to be a string
in the form of xxxx\tnum, meaning xxxx has num occurrences. | [
"add",
"the",
"given",
"val",
"to",
"the",
"aggregator",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/lib/aggregate/ValueHistogram.java#L47-L66 |
119,540 | facebookarchive/hadoop-20 | src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/DataGenerator.java | DataGenerator.run | public int run(String[] args) throws Exception {
int exitCode = 0;
exitCode = init(args);
if (exitCode != 0) {
return exitCode;
}
// genDirStructure();
genFiles();
return exitCode;
} | java | public int run(String[] args) throws Exception {
int exitCode = 0;
exitCode = init(args);
if (exitCode != 0) {
return exitCode;
}
// genDirStructure();
genFiles();
return exitCode;
} | [
"public",
"int",
"run",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"int",
"exitCode",
"=",
"0",
";",
"exitCode",
"=",
"init",
"(",
"args",
")",
";",
"if",
"(",
"exitCode",
"!=",
"0",
")",
"{",
"return",
"exitCode",
";",
"}",
... | Main function. It first parses the command line arguments. It then reads
the directory structure from the input directory structure file and
creates directory structure in the file system namespace. Afterwards it
reads the file attributes and creates files in the file. All file content
is filled with 'a'.
@return | [
"Main",
"function",
".",
"It",
"first",
"parses",
"the",
"command",
"line",
"arguments",
".",
"It",
"then",
"reads",
"the",
"directory",
"structure",
"from",
"the",
"input",
"directory",
"structure",
"file",
"and",
"creates",
"directory",
"structure",
"in",
"t... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/DataGenerator.java#L61-L70 |
119,541 | facebookarchive/hadoop-20 | src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/DataGenerator.java | DataGenerator.genDirStructure | @SuppressWarnings("unused")
private void genDirStructure() throws IOException {
BufferedReader in = new BufferedReader(new FileReader(new File(inDir,
StructureGenerator.DIR_STRUCTURE_FILE_NAME)));
String line;
while ((line = in.readLine()) != null) {
fs.mkdirs(new Path(root + line));
}
} | java | @SuppressWarnings("unused")
private void genDirStructure() throws IOException {
BufferedReader in = new BufferedReader(new FileReader(new File(inDir,
StructureGenerator.DIR_STRUCTURE_FILE_NAME)));
String line;
while ((line = in.readLine()) != null) {
fs.mkdirs(new Path(root + line));
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unused\"",
")",
"private",
"void",
"genDirStructure",
"(",
")",
"throws",
"IOException",
"{",
"BufferedReader",
"in",
"=",
"new",
"BufferedReader",
"(",
"new",
"FileReader",
"(",
"new",
"File",
"(",
"inDir",
",",
"StructureGenera... | Read directory structure file under the input directory. Create each
directory under the specified root. The directory names are relative to
the specified root. | [
"Read",
"directory",
"structure",
"file",
"under",
"the",
"input",
"directory",
".",
"Create",
"each",
"directory",
"under",
"the",
"specified",
"root",
".",
"The",
"directory",
"names",
"are",
"relative",
"to",
"the",
"specified",
"root",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/DataGenerator.java#L103-L111 |
119,542 | facebookarchive/hadoop-20 | src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/DataGenerator.java | DataGenerator.genFiles | private void genFiles() throws IOException {
//
// BufferedReader in = new BufferedReader(new FileReader(new File(inDir,
// StructureGenerator.FILE_STRUCTURE_FILE_NAME)));
// String line;
// while ((line = in.readLine()) != null) {
// String[] tokens = line.split(" ");
// if (tokens.length != 2) {
// th... | java | private void genFiles() throws IOException {
//
// BufferedReader in = new BufferedReader(new FileReader(new File(inDir,
// StructureGenerator.FILE_STRUCTURE_FILE_NAME)));
// String line;
// while ((line = in.readLine()) != null) {
// String[] tokens = line.split(" ");
// if (tokens.length != 2) {
// th... | [
"private",
"void",
"genFiles",
"(",
")",
"throws",
"IOException",
"{",
"//",
"// BufferedReader in = new BufferedReader(new FileReader(new File(inDir,",
"// StructureGenerator.FILE_STRUCTURE_FILE_NAME)));",
"// String line;",
"// while ((line = in.readLine()) != null) {",
"// String[] toke... | Read file structure file under the input directory. Create each file
under the specified root. The file names are relative to the root. | [
"Read",
"file",
"structure",
"file",
"under",
"the",
"input",
"directory",
".",
"Create",
"each",
"file",
"under",
"the",
"specified",
"root",
".",
"The",
"file",
"names",
"are",
"relative",
"to",
"the",
"root",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/benchmark/src/java/org/apache/hadoop/hdfs/DataGenerator.java#L117-L157 |
119,543 | facebookarchive/hadoop-20 | src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorEngine.java | SimulatorEngine.startTaskTrackers | void startTaskTrackers(ClusterStory clusterStory, long now) {
/** port assigned to TTs, incremented by 1 for each TT */
int port = 10000;
long ms = now + 100;
for (MachineNode node : clusterStory.getMachines()) {
String hostname = node.getName();
RackNode rackNode = node.getRackNode();
... | java | void startTaskTrackers(ClusterStory clusterStory, long now) {
/** port assigned to TTs, incremented by 1 for each TT */
int port = 10000;
long ms = now + 100;
for (MachineNode node : clusterStory.getMachines()) {
String hostname = node.getName();
RackNode rackNode = node.getRackNode();
... | [
"void",
"startTaskTrackers",
"(",
"ClusterStory",
"clusterStory",
",",
"long",
"now",
")",
"{",
"/** port assigned to TTs, incremented by 1 for each TT */",
"int",
"port",
"=",
"10000",
";",
"long",
"ms",
"=",
"now",
"+",
"100",
";",
"for",
"(",
"MachineNode",
"no... | Start simulated task trackers based on topology.
@param clusterStory The cluster topology.
@param now
time stamp when the simulator is started, {@link SimulatorTaskTracker}s
are started shortly after this time stamp | [
"Start",
"simulated",
"task",
"trackers",
"based",
"on",
"topology",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorEngine.java#L74-L90 |
119,544 | facebookarchive/hadoop-20 | src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorEngine.java | SimulatorEngine.init | @SuppressWarnings("deprecation")
void init() throws InterruptedException, IOException {
long now = System.currentTimeMillis();
JobConf jobConf = new JobConf(getConf());
jobConf.setClass("topology.node.switch.mapping.impl",
StaticMapping.class, DNSToSwitchMapping.class);
jobConf.set("fs.defaul... | java | @SuppressWarnings("deprecation")
void init() throws InterruptedException, IOException {
long now = System.currentTimeMillis();
JobConf jobConf = new JobConf(getConf());
jobConf.setClass("topology.node.switch.mapping.impl",
StaticMapping.class, DNSToSwitchMapping.class);
jobConf.set("fs.defaul... | [
"@",
"SuppressWarnings",
"(",
"\"deprecation\"",
")",
"void",
"init",
"(",
")",
"throws",
"InterruptedException",
",",
"IOException",
"{",
"long",
"now",
"=",
"System",
".",
"currentTimeMillis",
"(",
")",
";",
"JobConf",
"jobConf",
"=",
"new",
"JobConf",
"(",
... | Initiate components in the simulation.
@throws InterruptedException
@throws IOException if trace or topology files cannot be open | [
"Initiate",
"components",
"in",
"the",
"simulation",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorEngine.java#L97-L152 |
119,545 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/hash/JenkinsHash.java | JenkinsHash.main | public static void main(String[] args) throws IOException {
if (args.length != 1) {
System.err.println("Usage: JenkinsHash filename");
System.exit(-1);
}
FileInputStream in = new FileInputStream(args[0]);
byte[] bytes = new byte[512];
int value = 0;
JenkinsHash hash = new JenkinsHash... | java | public static void main(String[] args) throws IOException {
if (args.length != 1) {
System.err.println("Usage: JenkinsHash filename");
System.exit(-1);
}
FileInputStream in = new FileInputStream(args[0]);
byte[] bytes = new byte[512];
int value = 0;
JenkinsHash hash = new JenkinsHash... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"IOException",
"{",
"if",
"(",
"args",
".",
"length",
"!=",
"1",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Usage: JenkinsHash filename\"",
")",
";",
"System... | Compute the hash of the specified file
@param args name of file to compute hash of.
@throws IOException | [
"Compute",
"the",
"hash",
"of",
"the",
"specified",
"file"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/hash/JenkinsHash.java#L246-L259 |
119,546 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskStatus.java | TaskStatus.setStartTime | void setStartTime(long startTime) {
//Making the assumption of passed startTime to be a positive
//long value explicit.
if (startTime > 0) {
this.startTime = startTime;
} else {
//Using String utils to get the stack trace.
LOG.error("Trying to set illegal startTime for task : " + taski... | java | void setStartTime(long startTime) {
//Making the assumption of passed startTime to be a positive
//long value explicit.
if (startTime > 0) {
this.startTime = startTime;
} else {
//Using String utils to get the stack trace.
LOG.error("Trying to set illegal startTime for task : " + taski... | [
"void",
"setStartTime",
"(",
"long",
"startTime",
")",
"{",
"//Making the assumption of passed startTime to be a positive",
"//long value explicit.",
"if",
"(",
"startTime",
">",
"0",
")",
"{",
"this",
".",
"startTime",
"=",
"startTime",
";",
"}",
"else",
"{",
"//Us... | Set startTime of the task if start time is greater than zero.
@param startTime start time | [
"Set",
"startTime",
"of",
"the",
"task",
"if",
"start",
"time",
"is",
"greater",
"than",
"zero",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskStatus.java#L227-L238 |
119,547 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskStatus.java | TaskStatus.setPhase | void setPhase(Phase phase){
TaskStatus.Phase oldPhase = getPhase();
if (oldPhase != phase){
// sort phase started
if (phase == TaskStatus.Phase.SORT){
setShuffleFinishTime(JobTracker.getClock().getTime());
} else if (phase == TaskStatus.Phase.REDUCE){
setSortFinishTime(JobTrack... | java | void setPhase(Phase phase){
TaskStatus.Phase oldPhase = getPhase();
if (oldPhase != phase){
// sort phase started
if (phase == TaskStatus.Phase.SORT){
setShuffleFinishTime(JobTracker.getClock().getTime());
} else if (phase == TaskStatus.Phase.REDUCE){
setSortFinishTime(JobTrack... | [
"void",
"setPhase",
"(",
"Phase",
"phase",
")",
"{",
"TaskStatus",
".",
"Phase",
"oldPhase",
"=",
"getPhase",
"(",
")",
";",
"if",
"(",
"oldPhase",
"!=",
"phase",
")",
"{",
"// sort phase started",
"if",
"(",
"phase",
"==",
"TaskStatus",
".",
"Phase",
".... | Set current phase of this task.
@param phase phase of this task | [
"Set",
"current",
"phase",
"of",
"this",
"task",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskStatus.java#L252-L263 |
119,548 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/TaskStatus.java | TaskStatus.statusUpdate | synchronized void statusUpdate(State runState,
float progress,
String state,
Phase phase,
long finishTime) {
setRunState(runState);
setProgress(progress);
setStateString(stat... | java | synchronized void statusUpdate(State runState,
float progress,
String state,
Phase phase,
long finishTime) {
setRunState(runState);
setProgress(progress);
setStateString(stat... | [
"synchronized",
"void",
"statusUpdate",
"(",
"State",
"runState",
",",
"float",
"progress",
",",
"String",
"state",
",",
"Phase",
"phase",
",",
"long",
"finishTime",
")",
"{",
"setRunState",
"(",
"runState",
")",
";",
"setProgress",
"(",
"progress",
")",
";"... | Update specific fields of task status
This update is done in JobTracker when a cleanup attempt of task
reports its status. Then update only specific fields, not all.
@param runState
@param progress
@param state
@param phase
@param finishTime | [
"Update",
"specific",
"fields",
"of",
"task",
"status"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/TaskStatus.java#L378-L390 |
119,549 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/util/MD5FileUtils.java | MD5FileUtils.verifySavedMD5 | public static void verifySavedMD5(File dataFile, MD5Hash expectedMD5)
throws IOException {
MD5Hash storedHash = readStoredMd5ForFile(dataFile);
// Check the hash itself
if (!expectedMD5.equals(storedHash)) {
throw new IOException(
"File " + dataFile + " did not match stored MD5 checksu... | java | public static void verifySavedMD5(File dataFile, MD5Hash expectedMD5)
throws IOException {
MD5Hash storedHash = readStoredMd5ForFile(dataFile);
// Check the hash itself
if (!expectedMD5.equals(storedHash)) {
throw new IOException(
"File " + dataFile + " did not match stored MD5 checksu... | [
"public",
"static",
"void",
"verifySavedMD5",
"(",
"File",
"dataFile",
",",
"MD5Hash",
"expectedMD5",
")",
"throws",
"IOException",
"{",
"MD5Hash",
"storedHash",
"=",
"readStoredMd5ForFile",
"(",
"dataFile",
")",
";",
"// Check the hash itself",
"if",
"(",
"!",
"e... | Verify that the previously saved md5 for the given file matches
expectedMd5.
@throws IOException | [
"Verify",
"that",
"the",
"previously",
"saved",
"md5",
"for",
"the",
"given",
"file",
"matches",
"expectedMd5",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/util/MD5FileUtils.java#L54-L63 |
119,550 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/util/MD5FileUtils.java | MD5FileUtils.readStoredMd5ForFile | public static MD5Hash readStoredMd5ForFile(File dataFile) throws IOException {
File md5File = getDigestFileForFile(dataFile);
String md5Line;
if (!md5File.exists()) {
return null;
}
BufferedReader reader =
new BufferedReader(new FileReader(md5File));
try {
md5Line = ... | java | public static MD5Hash readStoredMd5ForFile(File dataFile) throws IOException {
File md5File = getDigestFileForFile(dataFile);
String md5Line;
if (!md5File.exists()) {
return null;
}
BufferedReader reader =
new BufferedReader(new FileReader(md5File));
try {
md5Line = ... | [
"public",
"static",
"MD5Hash",
"readStoredMd5ForFile",
"(",
"File",
"dataFile",
")",
"throws",
"IOException",
"{",
"File",
"md5File",
"=",
"getDigestFileForFile",
"(",
"dataFile",
")",
";",
"String",
"md5Line",
";",
"if",
"(",
"!",
"md5File",
".",
"exists",
"(... | Read the md5 checksum stored alongside the given file, or null
if no md5 is stored.
@param dataFile the file containing data
@return the checksum stored in dataFile.md5 | [
"Read",
"the",
"md5",
"checksum",
"stored",
"alongside",
"the",
"given",
"file",
"or",
"null",
"if",
"no",
"md5",
"is",
"stored",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/util/MD5FileUtils.java#L71-L109 |
119,551 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/util/MD5FileUtils.java | MD5FileUtils.computeMd5ForFile | public static MD5Hash computeMd5ForFile(File dataFile) throws IOException {
InputStream in = new FileInputStream(dataFile);
try {
MessageDigest digester = MD5Hash.getDigester();
DigestInputStream dis = new DigestInputStream(in, digester);
IOUtils.copyBytes(dis, new IOUtils.NullOutputStream(), ... | java | public static MD5Hash computeMd5ForFile(File dataFile) throws IOException {
InputStream in = new FileInputStream(dataFile);
try {
MessageDigest digester = MD5Hash.getDigester();
DigestInputStream dis = new DigestInputStream(in, digester);
IOUtils.copyBytes(dis, new IOUtils.NullOutputStream(), ... | [
"public",
"static",
"MD5Hash",
"computeMd5ForFile",
"(",
"File",
"dataFile",
")",
"throws",
"IOException",
"{",
"InputStream",
"in",
"=",
"new",
"FileInputStream",
"(",
"dataFile",
")",
";",
"try",
"{",
"MessageDigest",
"digester",
"=",
"MD5Hash",
".",
"getDiges... | Read dataFile and compute its MD5 checksum. | [
"Read",
"dataFile",
"and",
"compute",
"its",
"MD5",
"checksum",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/util/MD5FileUtils.java#L114-L125 |
119,552 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/util/MD5FileUtils.java | MD5FileUtils.saveMD5File | public static void saveMD5File(File dataFile, MD5Hash digest)
throws IOException {
File md5File = getDigestFileForFile(dataFile);
String digestString = StringUtils.byteToHexString(
digest.getDigest());
String md5Line = digestString + " *" + dataFile.getName() + "\n";
AtomicFileOutputS... | java | public static void saveMD5File(File dataFile, MD5Hash digest)
throws IOException {
File md5File = getDigestFileForFile(dataFile);
String digestString = StringUtils.byteToHexString(
digest.getDigest());
String md5Line = digestString + " *" + dataFile.getName() + "\n";
AtomicFileOutputS... | [
"public",
"static",
"void",
"saveMD5File",
"(",
"File",
"dataFile",
",",
"MD5Hash",
"digest",
")",
"throws",
"IOException",
"{",
"File",
"md5File",
"=",
"getDigestFileForFile",
"(",
"dataFile",
")",
";",
"String",
"digestString",
"=",
"StringUtils",
".",
"byteTo... | Save the ".md5" file that lists the md5sum of another file.
@param dataFile the original file whose md5 was computed
@param digest the computed digest
@throws IOException | [
"Save",
"the",
".",
"md5",
"file",
"that",
"lists",
"the",
"md5sum",
"of",
"another",
"file",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/util/MD5FileUtils.java#L133-L144 |
119,553 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/io/VIntWritable.java | VIntWritable.compareTo | public int compareTo(Object o) {
int thisValue = this.value;
int thatValue = ((VIntWritable)o).value;
return (thisValue < thatValue ? -1 : (thisValue == thatValue ? 0 : 1));
} | java | public int compareTo(Object o) {
int thisValue = this.value;
int thatValue = ((VIntWritable)o).value;
return (thisValue < thatValue ? -1 : (thisValue == thatValue ? 0 : 1));
} | [
"public",
"int",
"compareTo",
"(",
"Object",
"o",
")",
"{",
"int",
"thisValue",
"=",
"this",
".",
"value",
";",
"int",
"thatValue",
"=",
"(",
"(",
"VIntWritable",
")",
"o",
")",
".",
"value",
";",
"return",
"(",
"thisValue",
"<",
"thatValue",
"?",
"-... | Compares two VIntWritables. | [
"Compares",
"two",
"VIntWritables",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/io/VIntWritable.java#L62-L66 |
119,554 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/StatisticsEditsVisitor.java | StatisticsEditsVisitor.incrementOpCodeCount | private void incrementOpCodeCount(Byte opCode) {
if(!opCodeCount.containsKey(opCode)) {
opCodeCount.put(opCode, 0L);
}
Long newValue = opCodeCount.get(opCode) + 1;
opCodeCount.put(opCode, newValue);
} | java | private void incrementOpCodeCount(Byte opCode) {
if(!opCodeCount.containsKey(opCode)) {
opCodeCount.put(opCode, 0L);
}
Long newValue = opCodeCount.get(opCode) + 1;
opCodeCount.put(opCode, newValue);
} | [
"private",
"void",
"incrementOpCodeCount",
"(",
"Byte",
"opCode",
")",
"{",
"if",
"(",
"!",
"opCodeCount",
".",
"containsKey",
"(",
"opCode",
")",
")",
"{",
"opCodeCount",
".",
"put",
"(",
"opCode",
",",
"0L",
")",
";",
"}",
"Long",
"newValue",
"=",
"o... | Increment the op code counter
@param opCode opCode for which to increment count | [
"Increment",
"the",
"op",
"code",
"counter"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/tools/offlineEditsViewer/StatisticsEditsVisitor.java#L162-L168 |
119,555 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/EditLogInputStream.java | EditLogInputStream.readOp | public FSEditLogOp readOp() throws IOException {
FSEditLogOp ret;
if (cachedOp != null) {
ret = cachedOp;
cachedOp = null;
return ret;
}
return nextOp();
} | java | public FSEditLogOp readOp() throws IOException {
FSEditLogOp ret;
if (cachedOp != null) {
ret = cachedOp;
cachedOp = null;
return ret;
}
return nextOp();
} | [
"public",
"FSEditLogOp",
"readOp",
"(",
")",
"throws",
"IOException",
"{",
"FSEditLogOp",
"ret",
";",
"if",
"(",
"cachedOp",
"!=",
"null",
")",
"{",
"ret",
"=",
"cachedOp",
";",
"cachedOp",
"=",
"null",
";",
"return",
"ret",
";",
"}",
"return",
"nextOp",... | Read an operation from the stream
@return an operation from the stream or null if at end of stream
@throws IOException if there is an error reading from the stream | [
"Read",
"an",
"operation",
"from",
"the",
"stream"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/EditLogInputStream.java#L62-L70 |
119,556 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/EditLogInputStream.java | EditLogInputStream.skipUntil | public boolean skipUntil(long txid) throws IOException {
while (true) {
FSEditLogOp op = readOp();
if (op == null) {
return false;
}
if (op.getTransactionId() >= txid) {
cachedOp = op;
return true;
}
}
} | java | public boolean skipUntil(long txid) throws IOException {
while (true) {
FSEditLogOp op = readOp();
if (op == null) {
return false;
}
if (op.getTransactionId() >= txid) {
cachedOp = op;
return true;
}
}
} | [
"public",
"boolean",
"skipUntil",
"(",
"long",
"txid",
")",
"throws",
"IOException",
"{",
"while",
"(",
"true",
")",
"{",
"FSEditLogOp",
"op",
"=",
"readOp",
"(",
")",
";",
"if",
"(",
"op",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"if",
... | Skip edit log operations up to a given transaction ID, or until the
end of the edit log is reached.
After this function returns, the next call to readOp will return either
end-of-file (null) or a transaction with a txid equal to or higher than
the one we asked for.
@param txid The transaction ID to read up until.
... | [
"Skip",
"edit",
"log",
"operations",
"up",
"to",
"a",
"given",
"transaction",
"ID",
"or",
"until",
"the",
"end",
"of",
"the",
"edit",
"log",
"is",
"reached",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/EditLogInputStream.java#L124-L135 |
119,557 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/SkipBadRecords.java | SkipBadRecords.getSkipOutputPath | public static Path getSkipOutputPath(Configuration conf) {
String name = conf.get(OUT_PATH);
if(name!=null) {
if("none".equals(name)) {
return null;
}
return new Path(name);
}
Path outPath = FileOutputFormat.getOutputPath(new JobConf(conf));
return outPath==null ? null : n... | java | public static Path getSkipOutputPath(Configuration conf) {
String name = conf.get(OUT_PATH);
if(name!=null) {
if("none".equals(name)) {
return null;
}
return new Path(name);
}
Path outPath = FileOutputFormat.getOutputPath(new JobConf(conf));
return outPath==null ? null : n... | [
"public",
"static",
"Path",
"getSkipOutputPath",
"(",
"Configuration",
"conf",
")",
"{",
"String",
"name",
"=",
"conf",
".",
"get",
"(",
"OUT_PATH",
")",
";",
"if",
"(",
"name",
"!=",
"null",
")",
"{",
"if",
"(",
"\"none\"",
".",
"equals",
"(",
"name",... | Get the directory to which skipped records are written. By default it is
the sub directory of the output _logs directory.
User can stop writing skipped records by setting the value null.
@param conf the configuration.
@return path skip output directory. Null is returned if this is not set
and output directory is also ... | [
"Get",
"the",
"directory",
"to",
"which",
"skipped",
"records",
"are",
"written",
".",
"By",
"default",
"it",
"is",
"the",
"sub",
"directory",
"of",
"the",
"output",
"_logs",
"directory",
".",
"User",
"can",
"stop",
"writing",
"skipped",
"records",
"by",
"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/SkipBadRecords.java#L200-L211 |
119,558 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/SkipBadRecords.java | SkipBadRecords.setSkipOutputPath | public static void setSkipOutputPath(JobConf conf, Path path) {
String pathStr = null;
if(path==null) {
pathStr = "none";
} else {
pathStr = path.toString();
}
conf.set(OUT_PATH, pathStr);
} | java | public static void setSkipOutputPath(JobConf conf, Path path) {
String pathStr = null;
if(path==null) {
pathStr = "none";
} else {
pathStr = path.toString();
}
conf.set(OUT_PATH, pathStr);
} | [
"public",
"static",
"void",
"setSkipOutputPath",
"(",
"JobConf",
"conf",
",",
"Path",
"path",
")",
"{",
"String",
"pathStr",
"=",
"null",
";",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"pathStr",
"=",
"\"none\"",
";",
"}",
"else",
"{",
"pathStr",
"=",... | Set the directory to which skipped records are written. By default it is
the sub directory of the output _logs directory.
User can stop writing skipped records by setting the value null.
@param conf the configuration.
@param path skip output directory path | [
"Set",
"the",
"directory",
"to",
"which",
"skipped",
"records",
"are",
"written",
".",
"By",
"default",
"it",
"is",
"the",
"sub",
"directory",
"of",
"the",
"output",
"_logs",
"directory",
".",
"User",
"can",
"stop",
"writing",
"skipped",
"records",
"by",
"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/SkipBadRecords.java#L221-L229 |
119,559 | facebookarchive/hadoop-20 | src/mapred/org/apache/hadoop/mapred/MergeSorter.java | MergeSorter.sort | public RawKeyValueIterator sort() {
MergeSort m = new MergeSort(this);
int count = super.count;
if (count == 0) return null;
int [] pointers = super.pointers;
int [] pointersCopy = new int[count];
System.arraycopy(pointers, 0, pointersCopy, 0, count);
m.mergeSort(pointers, pointersCopy, 0, c... | java | public RawKeyValueIterator sort() {
MergeSort m = new MergeSort(this);
int count = super.count;
if (count == 0) return null;
int [] pointers = super.pointers;
int [] pointersCopy = new int[count];
System.arraycopy(pointers, 0, pointersCopy, 0, count);
m.mergeSort(pointers, pointersCopy, 0, c... | [
"public",
"RawKeyValueIterator",
"sort",
"(",
")",
"{",
"MergeSort",
"m",
"=",
"new",
"MergeSort",
"(",
"this",
")",
";",
"int",
"count",
"=",
"super",
".",
"count",
";",
"if",
"(",
"count",
"==",
"0",
")",
"return",
"null",
";",
"int",
"[",
"]",
"... | The sort method derived from BasicTypeSorterBase and overridden here | [
"The",
"sort",
"method",
"derived",
"from",
"BasicTypeSorterBase",
"and",
"overridden",
"here"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/mapred/org/apache/hadoop/mapred/MergeSorter.java#L41-L51 |
119,560 | facebookarchive/hadoop-20 | src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceRequestInfo.java | ResourceRequestInfo.write | public void write(JsonGenerator jsonGenerator) throws IOException {
// We neither need the list of RequestedNodes, nodes, nor excludedHosts,
// because we can reconstruct them from the request object
jsonGenerator.writeStartObject();
jsonGenerator.writeObjectField("request", request);
jsonGenerator.... | java | public void write(JsonGenerator jsonGenerator) throws IOException {
// We neither need the list of RequestedNodes, nodes, nor excludedHosts,
// because we can reconstruct them from the request object
jsonGenerator.writeStartObject();
jsonGenerator.writeObjectField("request", request);
jsonGenerator.... | [
"public",
"void",
"write",
"(",
"JsonGenerator",
"jsonGenerator",
")",
"throws",
"IOException",
"{",
"// We neither need the list of RequestedNodes, nodes, nor excludedHosts,",
"// because we can reconstruct them from the request object",
"jsonGenerator",
".",
"writeStartObject",
"(",
... | This method writes the ResourceRequestInfo instance to disk
@param jsonGenerator The JsonGenerator instance being used to write the
JSON to disk
@throws IOException | [
"This",
"method",
"writes",
"the",
"ResourceRequestInfo",
"instance",
"to",
"disk"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/corona/src/java/org/apache/hadoop/corona/ResourceRequestInfo.java#L100-L106 |
119,561 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FSOutputSummer.java | FSOutputSummer.write | public synchronized void write(int b) throws IOException {
eventStartWrite();
try {
sum.update(b);
buf[count++] = (byte) b;
if (bytesSentInChunk + count == buf.length) {
flushBuffer(true, shouldKeepPartialChunkData());
}
} finally {
eventEndWrite();
}
} | java | public synchronized void write(int b) throws IOException {
eventStartWrite();
try {
sum.update(b);
buf[count++] = (byte) b;
if (bytesSentInChunk + count == buf.length) {
flushBuffer(true, shouldKeepPartialChunkData());
}
} finally {
eventEndWrite();
}
} | [
"public",
"synchronized",
"void",
"write",
"(",
"int",
"b",
")",
"throws",
"IOException",
"{",
"eventStartWrite",
"(",
")",
";",
"try",
"{",
"sum",
".",
"update",
"(",
"b",
")",
";",
"buf",
"[",
"count",
"++",
"]",
"=",
"(",
"byte",
")",
"b",
";",
... | Write one byte | [
"Write",
"one",
"byte"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FSOutputSummer.java#L66-L78 |
119,562 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FSOutputSummer.java | FSOutputSummer.write1 | private int write1(byte b[], int off, int len) throws IOException {
eventStartWrite();
try {
if(count==0 && bytesSentInChunk + len>=buf.length) {
// local buffer is empty and user data can fill the current chunk
// checksum and output data
final int length = buf.length - bytesSent... | java | private int write1(byte b[], int off, int len) throws IOException {
eventStartWrite();
try {
if(count==0 && bytesSentInChunk + len>=buf.length) {
// local buffer is empty and user data can fill the current chunk
// checksum and output data
final int length = buf.length - bytesSent... | [
"private",
"int",
"write1",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"eventStartWrite",
"(",
")",
";",
"try",
"{",
"if",
"(",
"count",
"==",
"0",
"&&",
"bytesSentInChunk",
"+",
"len",
">=",
... | Write a portion of an array, flushing to the underlying
stream at most once if necessary. | [
"Write",
"a",
"portion",
"of",
"an",
"array",
"flushing",
"to",
"the",
"underlying",
"stream",
"at",
"most",
"once",
"if",
"necessary",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FSOutputSummer.java#L118-L147 |
119,563 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/fs/FSOutputSummer.java | FSOutputSummer.writeChecksumChunk | private void writeChecksumChunk(byte b[], int off, int len, boolean keep)
throws IOException {
int tempChecksum = (int)sum.getValue();
if (!keep) {
sum.reset();
}
int2byte(tempChecksum, checksum);
writeChunk(b, off, len, checksum);
} | java | private void writeChecksumChunk(byte b[], int off, int len, boolean keep)
throws IOException {
int tempChecksum = (int)sum.getValue();
if (!keep) {
sum.reset();
}
int2byte(tempChecksum, checksum);
writeChunk(b, off, len, checksum);
} | [
"private",
"void",
"writeChecksumChunk",
"(",
"byte",
"b",
"[",
"]",
",",
"int",
"off",
",",
"int",
"len",
",",
"boolean",
"keep",
")",
"throws",
"IOException",
"{",
"int",
"tempChecksum",
"=",
"(",
"int",
")",
"sum",
".",
"getValue",
"(",
")",
";",
... | Generate checksum for the data chunk and output data chunk & checksum
to the underlying output stream. If keep is true then keep the
current checksum intact, do not reset it. | [
"Generate",
"checksum",
"for",
"the",
"data",
"chunk",
"and",
"output",
"data",
"chunk",
"&",
"checksum",
"to",
"the",
"underlying",
"output",
"stream",
".",
"If",
"keep",
"is",
"true",
"then",
"keep",
"the",
"current",
"checksum",
"intact",
"do",
"not",
"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/fs/FSOutputSummer.java#L175-L183 |
119,564 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java | INode.getUserName | public String getUserName() {
int n = (int)PermissionStatusFormat.USER.retrieve(permission);
return SerialNumberManager.INSTANCE.getUser(n);
} | java | public String getUserName() {
int n = (int)PermissionStatusFormat.USER.retrieve(permission);
return SerialNumberManager.INSTANCE.getUser(n);
} | [
"public",
"String",
"getUserName",
"(",
")",
"{",
"int",
"n",
"=",
"(",
"int",
")",
"PermissionStatusFormat",
".",
"USER",
".",
"retrieve",
"(",
"permission",
")",
";",
"return",
"SerialNumberManager",
".",
"INSTANCE",
".",
"getUser",
"(",
"n",
")",
";",
... | Get user name | [
"Get",
"user",
"name"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java#L183-L186 |
119,565 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java | INode.getGroupName | public String getGroupName() {
int n = (int)PermissionStatusFormat.GROUP.retrieve(permission);
return SerialNumberManager.INSTANCE.getGroup(n);
} | java | public String getGroupName() {
int n = (int)PermissionStatusFormat.GROUP.retrieve(permission);
return SerialNumberManager.INSTANCE.getGroup(n);
} | [
"public",
"String",
"getGroupName",
"(",
")",
"{",
"int",
"n",
"=",
"(",
"int",
")",
"PermissionStatusFormat",
".",
"GROUP",
".",
"retrieve",
"(",
"permission",
")",
";",
"return",
"SerialNumberManager",
".",
"INSTANCE",
".",
"getGroup",
"(",
"n",
")",
";"... | Get group name | [
"Get",
"group",
"name"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java#L193-L196 |
119,566 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java | INode.enforceRegularStorageINode | public static void enforceRegularStorageINode(INodeFile inode, String msg)
throws IOException {
if (inode.getStorageType() != StorageType.REGULAR_STORAGE) {
LOG.error(msg);
throw new IOException(msg);
}
} | java | public static void enforceRegularStorageINode(INodeFile inode, String msg)
throws IOException {
if (inode.getStorageType() != StorageType.REGULAR_STORAGE) {
LOG.error(msg);
throw new IOException(msg);
}
} | [
"public",
"static",
"void",
"enforceRegularStorageINode",
"(",
"INodeFile",
"inode",
",",
"String",
"msg",
")",
"throws",
"IOException",
"{",
"if",
"(",
"inode",
".",
"getStorageType",
"(",
")",
"!=",
"StorageType",
".",
"REGULAR_STORAGE",
")",
"{",
"LOG",
"."... | Verify if file is regular storage, otherwise throw an exception | [
"Verify",
"if",
"file",
"is",
"regular",
"storage",
"otherwise",
"throw",
"an",
"exception"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java#L251-L257 |
119,567 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java | INode.getPathComponents | static byte[][] getPathComponents(String[] strings) {
if (strings.length == 0) {
return new byte[][]{null};
}
byte[][] bytes = new byte[strings.length][];
for (int i = 0; i < strings.length; i++)
bytes[i] = DFSUtil.string2Bytes(strings[i]);
return bytes;
} | java | static byte[][] getPathComponents(String[] strings) {
if (strings.length == 0) {
return new byte[][]{null};
}
byte[][] bytes = new byte[strings.length][];
for (int i = 0; i < strings.length; i++)
bytes[i] = DFSUtil.string2Bytes(strings[i]);
return bytes;
} | [
"static",
"byte",
"[",
"]",
"[",
"]",
"getPathComponents",
"(",
"String",
"[",
"]",
"strings",
")",
"{",
"if",
"(",
"strings",
".",
"length",
"==",
"0",
")",
"{",
"return",
"new",
"byte",
"[",
"]",
"[",
"]",
"{",
"null",
"}",
";",
"}",
"byte",
... | Convert strings to byte arrays for path components. | [
"Convert",
"strings",
"to",
"byte",
"arrays",
"for",
"path",
"components",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java#L404-L412 |
119,568 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java | INode.getPathNames | static String[] getPathNames(String path) {
if (path == null || !path.startsWith(Path.SEPARATOR)) {
return null;
}
return StringUtils.split(path, Path.SEPARATOR_CHAR);
} | java | static String[] getPathNames(String path) {
if (path == null || !path.startsWith(Path.SEPARATOR)) {
return null;
}
return StringUtils.split(path, Path.SEPARATOR_CHAR);
} | [
"static",
"String",
"[",
"]",
"getPathNames",
"(",
"String",
"path",
")",
"{",
"if",
"(",
"path",
"==",
"null",
"||",
"!",
"path",
".",
"startsWith",
"(",
"Path",
".",
"SEPARATOR",
")",
")",
"{",
"return",
"null",
";",
"}",
"return",
"StringUtils",
"... | Breaks file path into names.
@param path
@return array of names | [
"Breaks",
"file",
"path",
"into",
"names",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java#L419-L424 |
119,569 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java | INode.compareTo | public final int compareTo(byte[] name2) {
if (name == name2)
return 0;
int len1 = (name == null ? 0 : name.length);
int len2 = (name2 == null ? 0 : name2.length);
int n = Math.min(len1, len2);
byte b1, b2;
for (int i = 0; i < n; i++) {
b1 = name[i];
b2 = name2[i];
if (b1... | java | public final int compareTo(byte[] name2) {
if (name == name2)
return 0;
int len1 = (name == null ? 0 : name.length);
int len2 = (name2 == null ? 0 : name2.length);
int n = Math.min(len1, len2);
byte b1, b2;
for (int i = 0; i < n; i++) {
b1 = name[i];
b2 = name2[i];
if (b1... | [
"public",
"final",
"int",
"compareTo",
"(",
"byte",
"[",
"]",
"name2",
")",
"{",
"if",
"(",
"name",
"==",
"name2",
")",
"return",
"0",
";",
"int",
"len1",
"=",
"(",
"name",
"==",
"null",
"?",
"0",
":",
"name",
".",
"length",
")",
";",
"int",
"l... | Compare names of the inodes
@return a negative integer, zero, or a positive integer | [
"Compare",
"names",
"of",
"the",
"inodes"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java#L446-L460 |
119,570 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java | INode.newINode | static INode newINode(long id,
PermissionStatus permissions,
BlockInfo[] blocks,
short replication,
long modificationTime,
long atime,
long nsQuota,
lo... | java | static INode newINode(long id,
PermissionStatus permissions,
BlockInfo[] blocks,
short replication,
long modificationTime,
long atime,
long nsQuota,
lo... | [
"static",
"INode",
"newINode",
"(",
"long",
"id",
",",
"PermissionStatus",
"permissions",
",",
"BlockInfo",
"[",
"]",
"blocks",
",",
"short",
"replication",
",",
"long",
"modificationTime",
",",
"long",
"atime",
",",
"long",
"nsQuota",
",",
"long",
"dsQuota",
... | Create an INode; the inode's name is not set yet
@param id inode id
@param permissions permissions
@param blocks blocks if a file
@param symlink symblic link if a symbolic link
@param replication replication factor
@param modificationTime modification time
@param atime access time
@param nsQuota namespace quota
@param... | [
"Create",
"an",
"INode",
";",
"the",
"inode",
"s",
"name",
"is",
"not",
"set",
"yet"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/namenode/INode.java#L519-L574 |
119,571 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataBlockScannerSet.java | DataBlockScannerSet.waitForUpgradeDone | private void waitForUpgradeDone(int namespaceId) {
UpgradeManagerDatanode um = datanode.getUpgradeManager(namespaceId);
while (!um.isUpgradeCompleted()) {
try {
datanode.updateAndReportThreadLiveness(BackgroundThread.BLOCK_SCANNER);
Thread.sleep(5000);
LOG.info("sleeping ............. | java | private void waitForUpgradeDone(int namespaceId) {
UpgradeManagerDatanode um = datanode.getUpgradeManager(namespaceId);
while (!um.isUpgradeCompleted()) {
try {
datanode.updateAndReportThreadLiveness(BackgroundThread.BLOCK_SCANNER);
Thread.sleep(5000);
LOG.info("sleeping ............. | [
"private",
"void",
"waitForUpgradeDone",
"(",
"int",
"namespaceId",
")",
"{",
"UpgradeManagerDatanode",
"um",
"=",
"datanode",
".",
"getUpgradeManager",
"(",
"namespaceId",
")",
";",
"while",
"(",
"!",
"um",
".",
"isUpgradeCompleted",
"(",
")",
")",
"{",
"try"... | Wait for upgrading done for the given namespace | [
"Wait",
"for",
"upgrading",
"done",
"for",
"the",
"given",
"namespace"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataBlockScannerSet.java#L130-L142 |
119,572 | facebookarchive/hadoop-20 | src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataBlockScannerSet.java | DataBlockScannerSet.getNextNamespaceSliceScanner | private DataBlockScanner getNextNamespaceSliceScanner(int currentNamespaceId) {
Integer nextNsId = null;
while ((nextNsId == null) && datanode.shouldRun
&& !blockScannerThread.isInterrupted()) {
waitForOneNameSpaceUp();
synchronized (this) {
if (getNamespaceSetSize() > 0) {
... | java | private DataBlockScanner getNextNamespaceSliceScanner(int currentNamespaceId) {
Integer nextNsId = null;
while ((nextNsId == null) && datanode.shouldRun
&& !blockScannerThread.isInterrupted()) {
waitForOneNameSpaceUp();
synchronized (this) {
if (getNamespaceSetSize() > 0) {
... | [
"private",
"DataBlockScanner",
"getNextNamespaceSliceScanner",
"(",
"int",
"currentNamespaceId",
")",
"{",
"Integer",
"nextNsId",
"=",
"null",
";",
"while",
"(",
"(",
"nextNsId",
"==",
"null",
")",
"&&",
"datanode",
".",
"shouldRun",
"&&",
"!",
"blockScannerThread... | Find next namespaceId to scan. There should be only one current
verification log file. Find which namespace contains the current
verification log file and that is used as the starting namespaceId. If no
current files are found start with first namespace. However, if more than
one current files are found, the one with l... | [
"Find",
"next",
"namespaceId",
"to",
"scan",
".",
"There",
"should",
"be",
"only",
"one",
"current",
"verification",
"log",
"file",
".",
"Find",
"which",
"namespace",
"contains",
"the",
"current",
"verification",
"log",
"file",
"and",
"that",
"is",
"used",
"... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/hdfs/org/apache/hadoop/hdfs/server/datanode/DataBlockScannerSet.java#L152-L214 |
119,573 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/util/bloom/HashFunction.java | HashFunction.hash | public int[] hash(Key k){
byte[] b = k.getBytes();
if (b == null) {
throw new NullPointerException("buffer reference is null");
}
if (b.length == 0) {
throw new IllegalArgumentException("key length must be > 0");
}
int[] result = new int[nbHash];
for (int i = 0,... | java | public int[] hash(Key k){
byte[] b = k.getBytes();
if (b == null) {
throw new NullPointerException("buffer reference is null");
}
if (b.length == 0) {
throw new IllegalArgumentException("key length must be > 0");
}
int[] result = new int[nbHash];
for (int i = 0,... | [
"public",
"int",
"[",
"]",
"hash",
"(",
"Key",
"k",
")",
"{",
"byte",
"[",
"]",
"b",
"=",
"k",
".",
"getBytes",
"(",
")",
";",
"if",
"(",
"b",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"buffer reference is null\"",
")",
... | Hashes a specified key into several integers.
@param k The specified key.
@return The array of hashed values. | [
"Hashes",
"a",
"specified",
"key",
"into",
"several",
"integers",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/util/bloom/HashFunction.java#L104-L118 |
119,574 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HttpServer.java | HttpServer.createBaseListener | protected Connector createBaseListener(Configuration conf)
throws IOException {
Connector ret;
if (conf.getBoolean("hadoop.http.bio", false)) {
SocketConnector conn = new SocketConnector();
conn.setAcceptQueueSize(4096);
conn.setResolveNames(false);
ret = conn;
} else {
S... | java | protected Connector createBaseListener(Configuration conf)
throws IOException {
Connector ret;
if (conf.getBoolean("hadoop.http.bio", false)) {
SocketConnector conn = new SocketConnector();
conn.setAcceptQueueSize(4096);
conn.setResolveNames(false);
ret = conn;
} else {
S... | [
"protected",
"Connector",
"createBaseListener",
"(",
"Configuration",
"conf",
")",
"throws",
"IOException",
"{",
"Connector",
"ret",
";",
"if",
"(",
"conf",
".",
"getBoolean",
"(",
"\"hadoop.http.bio\"",
",",
"false",
")",
")",
"{",
"SocketConnector",
"conn",
"=... | Create a required listener for the Jetty instance listening on the port
provided. This wrapper and all subclasses must create at least one
listener. | [
"Create",
"a",
"required",
"listener",
"for",
"the",
"Jetty",
"instance",
"listening",
"on",
"the",
"port",
"provided",
".",
"This",
"wrapper",
"and",
"all",
"subclasses",
"must",
"create",
"at",
"least",
"one",
"listener",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HttpServer.java#L168-L187 |
119,575 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HttpServer.java | HttpServer.getFilterInitializers | private static FilterInitializer[] getFilterInitializers(Configuration conf) {
if (conf == null) {
return null;
}
Class<?>[] classes = conf.getClasses(FILTER_INITIALIZER_PROPERTY);
if (classes == null) {
return null;
}
FilterInitializer[] initializers = new FilterInitializer[classe... | java | private static FilterInitializer[] getFilterInitializers(Configuration conf) {
if (conf == null) {
return null;
}
Class<?>[] classes = conf.getClasses(FILTER_INITIALIZER_PROPERTY);
if (classes == null) {
return null;
}
FilterInitializer[] initializers = new FilterInitializer[classe... | [
"private",
"static",
"FilterInitializer",
"[",
"]",
"getFilterInitializers",
"(",
"Configuration",
"conf",
")",
"{",
"if",
"(",
"conf",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"Class",
"<",
"?",
">",
"[",
"]",
"classes",
"=",
"conf",
".",
"... | Get an array of FilterConfiguration specified in the conf | [
"Get",
"an",
"array",
"of",
"FilterConfiguration",
"specified",
"in",
"the",
"conf"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HttpServer.java#L190-L206 |
119,576 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HttpServer.java | HttpServer.addDefaultApps | protected void addDefaultApps(ContextHandlerCollection parent,
final String appDir) throws IOException {
// set up the context for "/logs/" if "hadoop.log.dir" property is defined.
String logDir = System.getProperty("hadoop.log.dir");
if (logDir != null) {
Context logContext = new Context(paren... | java | protected void addDefaultApps(ContextHandlerCollection parent,
final String appDir) throws IOException {
// set up the context for "/logs/" if "hadoop.log.dir" property is defined.
String logDir = System.getProperty("hadoop.log.dir");
if (logDir != null) {
Context logContext = new Context(paren... | [
"protected",
"void",
"addDefaultApps",
"(",
"ContextHandlerCollection",
"parent",
",",
"final",
"String",
"appDir",
")",
"throws",
"IOException",
"{",
"// set up the context for \"/logs/\" if \"hadoop.log.dir\" property is defined. ",
"String",
"logDir",
"=",
"System",
".",
"... | Add default apps.
@param appDir The application directory
@throws IOException | [
"Add",
"default",
"apps",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HttpServer.java#L213-L228 |
119,577 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HttpServer.java | HttpServer.addDefaultServlets | protected void addDefaultServlets() {
// set up default servlets
addServlet("stacks", "/stacks", StackServlet.class);
addServlet("logLevel", "/logLevel", LogLevel.Servlet.class);
addServlet("jmx", "/jmx", JMXJsonServlet.class);
addServlet("metrics", "/metrics", MetricsServlet.class);
addServlet(... | java | protected void addDefaultServlets() {
// set up default servlets
addServlet("stacks", "/stacks", StackServlet.class);
addServlet("logLevel", "/logLevel", LogLevel.Servlet.class);
addServlet("jmx", "/jmx", JMXJsonServlet.class);
addServlet("metrics", "/metrics", MetricsServlet.class);
addServlet(... | [
"protected",
"void",
"addDefaultServlets",
"(",
")",
"{",
"// set up default servlets",
"addServlet",
"(",
"\"stacks\"",
",",
"\"/stacks\"",
",",
"StackServlet",
".",
"class",
")",
";",
"addServlet",
"(",
"\"logLevel\"",
",",
"\"/logLevel\"",
",",
"LogLevel",
".",
... | Add default servlets. | [
"Add",
"default",
"servlets",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HttpServer.java#L233-L240 |
119,578 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HttpServer.java | HttpServer.addContext | protected void addContext(String pathSpec, String dir, boolean isFiltered) throws IOException {
if (0 == webServer.getHandlers().length) {
throw new RuntimeException("Couldn't find handler");
}
WebAppContext webAppCtx = new WebAppContext();
webAppCtx.setContextPath(pathSpec);
webAppCtx.setWar(... | java | protected void addContext(String pathSpec, String dir, boolean isFiltered) throws IOException {
if (0 == webServer.getHandlers().length) {
throw new RuntimeException("Couldn't find handler");
}
WebAppContext webAppCtx = new WebAppContext();
webAppCtx.setContextPath(pathSpec);
webAppCtx.setWar(... | [
"protected",
"void",
"addContext",
"(",
"String",
"pathSpec",
",",
"String",
"dir",
",",
"boolean",
"isFiltered",
")",
"throws",
"IOException",
"{",
"if",
"(",
"0",
"==",
"webServer",
".",
"getHandlers",
"(",
")",
".",
"length",
")",
"{",
"throw",
"new",
... | Add a context
@param pathSpec The path spec for the context
@param dir The directory containing the context
@param isFiltered if true, the servlet is added to the filter path mapping
@throws IOException | [
"Add",
"a",
"context"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HttpServer.java#L255-L263 |
119,579 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HttpServer.java | HttpServer.addServlet | public void addServlet(String name, String pathSpec,
Class<? extends HttpServlet> clazz) {
addInternalServlet(name, pathSpec, clazz);
addFilterPathMapping(pathSpec, webAppContext);
} | java | public void addServlet(String name, String pathSpec,
Class<? extends HttpServlet> clazz) {
addInternalServlet(name, pathSpec, clazz);
addFilterPathMapping(pathSpec, webAppContext);
} | [
"public",
"void",
"addServlet",
"(",
"String",
"name",
",",
"String",
"pathSpec",
",",
"Class",
"<",
"?",
"extends",
"HttpServlet",
">",
"clazz",
")",
"{",
"addInternalServlet",
"(",
"name",
",",
"pathSpec",
",",
"clazz",
")",
";",
"addFilterPathMapping",
"(... | Add a servlet in the server.
@param name The name of the servlet (can be passed as null)
@param pathSpec The path spec for the servlet
@param clazz The servlet class | [
"Add",
"a",
"servlet",
"in",
"the",
"server",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HttpServer.java#L281-L285 |
119,580 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HttpServer.java | HttpServer.addInternalServlet | @Deprecated
public void addInternalServlet(String name, String pathSpec,
Class<? extends HttpServlet> clazz) {
ServletHolder holder = new ServletHolder(clazz);
if (name != null) {
holder.setName(name);
}
webAppContext.addServlet(holder, pathSpec);
} | java | @Deprecated
public void addInternalServlet(String name, String pathSpec,
Class<? extends HttpServlet> clazz) {
ServletHolder holder = new ServletHolder(clazz);
if (name != null) {
holder.setName(name);
}
webAppContext.addServlet(holder, pathSpec);
} | [
"@",
"Deprecated",
"public",
"void",
"addInternalServlet",
"(",
"String",
"name",
",",
"String",
"pathSpec",
",",
"Class",
"<",
"?",
"extends",
"HttpServlet",
">",
"clazz",
")",
"{",
"ServletHolder",
"holder",
"=",
"new",
"ServletHolder",
"(",
"clazz",
")",
... | Add an internal servlet in the server.
@param name The name of the servlet (can be passed as null)
@param pathSpec The path spec for the servlet
@param clazz The servlet class
@deprecated this is a temporary method | [
"Add",
"an",
"internal",
"servlet",
"in",
"the",
"server",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HttpServer.java#L294-L302 |
119,581 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HttpServer.java | HttpServer.removeServlet | public void removeServlet(String name, String pathSpec,
Class<? extends HttpServlet> clazz) {
if(clazz == null) {
return;
}
//remove the filters from filterPathMapping
ServletHandler servletHandler = webAppContext.getServletHandler();
List<FilterMapping> newFilterMappings = new ArrayLi... | java | public void removeServlet(String name, String pathSpec,
Class<? extends HttpServlet> clazz) {
if(clazz == null) {
return;
}
//remove the filters from filterPathMapping
ServletHandler servletHandler = webAppContext.getServletHandler();
List<FilterMapping> newFilterMappings = new ArrayLi... | [
"public",
"void",
"removeServlet",
"(",
"String",
"name",
",",
"String",
"pathSpec",
",",
"Class",
"<",
"?",
"extends",
"HttpServlet",
">",
"clazz",
")",
"{",
"if",
"(",
"clazz",
"==",
"null",
")",
"{",
"return",
";",
"}",
"//remove the filters from filterPa... | Remove a servlet in the server.
@param name The name of the servlet (can be passed as null)
@param pathSpec The path spec for the servlet
@param clazz The servlet class | [
"Remove",
"a",
"servlet",
"in",
"the",
"server",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HttpServer.java#L310-L332 |
119,582 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HttpServer.java | HttpServer.removeInternalServlet | public void removeInternalServlet(String name, String pathSpec,
Class<? extends HttpServlet> clazz) {
if(null == clazz) {
return;
}
ServletHandler servletHandler = webAppContext.getServletHandler();
List<ServletHolder> newServletHolders = new ArrayList<ServletHolder>();
List<Servle... | java | public void removeInternalServlet(String name, String pathSpec,
Class<? extends HttpServlet> clazz) {
if(null == clazz) {
return;
}
ServletHandler servletHandler = webAppContext.getServletHandler();
List<ServletHolder> newServletHolders = new ArrayList<ServletHolder>();
List<Servle... | [
"public",
"void",
"removeInternalServlet",
"(",
"String",
"name",
",",
"String",
"pathSpec",
",",
"Class",
"<",
"?",
"extends",
"HttpServlet",
">",
"clazz",
")",
"{",
"if",
"(",
"null",
"==",
"clazz",
")",
"{",
"return",
";",
"}",
"ServletHandler",
"servle... | Remove an internal servlet in the server.
@param clazz The servlet class | [
"Remove",
"an",
"internal",
"servlet",
"in",
"the",
"server",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HttpServer.java#L338-L398 |
119,583 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HttpServer.java | HttpServer.defineFilter | protected void defineFilter(Context ctx, String name,
String classname, Map<String,String> parameters, String[] urls) {
FilterHolder holder = new FilterHolder();
holder.setName(name);
holder.setClassName(classname);
holder.setInitParameters(parameters);
FilterMapping fmap = new FilterMapping(... | java | protected void defineFilter(Context ctx, String name,
String classname, Map<String,String> parameters, String[] urls) {
FilterHolder holder = new FilterHolder();
holder.setName(name);
holder.setClassName(classname);
holder.setInitParameters(parameters);
FilterMapping fmap = new FilterMapping(... | [
"protected",
"void",
"defineFilter",
"(",
"Context",
"ctx",
",",
"String",
"name",
",",
"String",
"classname",
",",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
",",
"String",
"[",
"]",
"urls",
")",
"{",
"FilterHolder",
"holder",
"=",
"new",
"... | Define a filter for a context and set up default url mappings. | [
"Define",
"a",
"filter",
"for",
"a",
"context",
"and",
"set",
"up",
"default",
"url",
"mappings",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HttpServer.java#L432-L445 |
119,584 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HttpServer.java | HttpServer.addFilterPathMapping | protected void addFilterPathMapping(String pathSpec,
Context webAppCtx) {
ServletHandler handler = webAppCtx.getServletHandler();
for(String name : filterNames) {
FilterMapping fmap = new FilterMapping();
fmap.setPathSpec(pathSpec);
fmap.setFilterName(name);
fmap.setDispatches(Hand... | java | protected void addFilterPathMapping(String pathSpec,
Context webAppCtx) {
ServletHandler handler = webAppCtx.getServletHandler();
for(String name : filterNames) {
FilterMapping fmap = new FilterMapping();
fmap.setPathSpec(pathSpec);
fmap.setFilterName(name);
fmap.setDispatches(Hand... | [
"protected",
"void",
"addFilterPathMapping",
"(",
"String",
"pathSpec",
",",
"Context",
"webAppCtx",
")",
"{",
"ServletHandler",
"handler",
"=",
"webAppCtx",
".",
"getServletHandler",
"(",
")",
";",
"for",
"(",
"String",
"name",
":",
"filterNames",
")",
"{",
"... | Add the path spec to the filter path mapping.
@param pathSpec The path spec
@param webAppCtx The WebApplicationContext to add to | [
"Add",
"the",
"path",
"spec",
"to",
"the",
"filter",
"path",
"mapping",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HttpServer.java#L452-L462 |
119,585 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HttpServer.java | HttpServer.getWebAppsPath | protected String getWebAppsPath() throws IOException {
URL url = getClass().getClassLoader().getResource("webapps");
if (url == null)
throw new IOException("webapps not found in CLASSPATH");
return url.toString();
} | java | protected String getWebAppsPath() throws IOException {
URL url = getClass().getClassLoader().getResource("webapps");
if (url == null)
throw new IOException("webapps not found in CLASSPATH");
return url.toString();
} | [
"protected",
"String",
"getWebAppsPath",
"(",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"getResource",
"(",
"\"webapps\"",
")",
";",
"if",
"(",
"url",
"==",
"null",
")",
"throw",
"ne... | Get the pathname to the webapps files.
@return the pathname as a URL
@throws IOException if 'webapps' directory cannot be found on CLASSPATH. | [
"Get",
"the",
"pathname",
"to",
"the",
"webapps",
"files",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HttpServer.java#L478-L483 |
119,586 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/http/HttpServer.java | HttpServer.stop | public void stop() throws Exception {
listener.close();
webAppContext.clearAttributes();
webServer.removeHandler(webAppContext);
webServer.stop();
} | java | public void stop() throws Exception {
listener.close();
webAppContext.clearAttributes();
webServer.removeHandler(webAppContext);
webServer.stop();
} | [
"public",
"void",
"stop",
"(",
")",
"throws",
"Exception",
"{",
"listener",
".",
"close",
"(",
")",
";",
"webAppContext",
".",
"clearAttributes",
"(",
")",
";",
"webServer",
".",
"removeHandler",
"(",
"webAppContext",
")",
";",
"webServer",
".",
"stop",
"(... | stop the server | [
"stop",
"the",
"server"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/http/HttpServer.java#L679-L684 |
119,587 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java | AbstractMetricsContext.getAttribute | protected String getAttribute(String attributeName) {
String factoryAttribute = contextName + "." + attributeName;
return (String) factory.getAttribute(factoryAttribute);
} | java | protected String getAttribute(String attributeName) {
String factoryAttribute = contextName + "." + attributeName;
return (String) factory.getAttribute(factoryAttribute);
} | [
"protected",
"String",
"getAttribute",
"(",
"String",
"attributeName",
")",
"{",
"String",
"factoryAttribute",
"=",
"contextName",
"+",
"\".\"",
"+",
"attributeName",
";",
"return",
"(",
"String",
")",
"factory",
".",
"getAttribute",
"(",
"factoryAttribute",
")",
... | Convenience method for subclasses to access factory attributes. | [
"Convenience",
"method",
"for",
"subclasses",
"to",
"access",
"factory",
"attributes",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java#L124-L127 |
119,588 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java | AbstractMetricsContext.registerUpdater | public synchronized void registerUpdater(final Updater updater) {
if (!updaters.containsKey(updater)) {
updaters.put(updater, Boolean.TRUE);
}
} | java | public synchronized void registerUpdater(final Updater updater) {
if (!updaters.containsKey(updater)) {
updaters.put(updater, Boolean.TRUE);
}
} | [
"public",
"synchronized",
"void",
"registerUpdater",
"(",
"final",
"Updater",
"updater",
")",
"{",
"if",
"(",
"!",
"updaters",
".",
"containsKey",
"(",
"updater",
")",
")",
"{",
"updaters",
".",
"put",
"(",
"updater",
",",
"Boolean",
".",
"TRUE",
")",
";... | Registers a callback to be called at time intervals determined by
the configuration.
@param updater object to be run periodically; it should update
some metrics records | [
"Registers",
"a",
"callback",
"to",
"be",
"called",
"at",
"time",
"intervals",
"determined",
"by",
"the",
"configuration",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java#L231-L235 |
119,589 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java | AbstractMetricsContext.startTimer | private synchronized void startTimer() {
if (timer == null) {
timer = new Timer("Timer thread for monitoring " + getContextName(),
true);
TimerTask task = new TimerTask() {
public void run() {
try {
timerEvent();
}
... | java | private synchronized void startTimer() {
if (timer == null) {
timer = new Timer("Timer thread for monitoring " + getContextName(),
true);
TimerTask task = new TimerTask() {
public void run() {
try {
timerEvent();
}
... | [
"private",
"synchronized",
"void",
"startTimer",
"(",
")",
"{",
"if",
"(",
"timer",
"==",
"null",
")",
"{",
"timer",
"=",
"new",
"Timer",
"(",
"\"Timer thread for monitoring \"",
"+",
"getContextName",
"(",
")",
",",
"true",
")",
";",
"TimerTask",
"task",
... | Starts timer if it is not already started | [
"Starts",
"timer",
"if",
"it",
"is",
"not",
"already",
"started"
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java#L253-L270 |
119,590 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java | AbstractMetricsContext.timerEvent | private void timerEvent() throws IOException {
if (isMonitoring) {
Collection<Updater> myUpdaters;
synchronized (this) {
myUpdaters = new ArrayList<Updater>(updaters.keySet());
}
// Run all the registered updates without holding a lock
// on this context
for (Updater upda... | java | private void timerEvent() throws IOException {
if (isMonitoring) {
Collection<Updater> myUpdaters;
synchronized (this) {
myUpdaters = new ArrayList<Updater>(updaters.keySet());
}
// Run all the registered updates without holding a lock
// on this context
for (Updater upda... | [
"private",
"void",
"timerEvent",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isMonitoring",
")",
"{",
"Collection",
"<",
"Updater",
">",
"myUpdaters",
";",
"synchronized",
"(",
"this",
")",
"{",
"myUpdaters",
"=",
"new",
"ArrayList",
"<",
"Updater",
... | Timer callback. | [
"Timer",
"callback",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java#L285-L303 |
119,591 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java | AbstractMetricsContext.emitRecords | private synchronized void emitRecords() throws IOException {
for (String recordName : bufferedData.keySet()) {
RecordMap recordMap = bufferedData.get(recordName);
synchronized (recordMap) {
Set<Entry<TagMap, MetricMap>> entrySet = recordMap.entrySet ();
for (Entry<TagMap, MetricMap>... | java | private synchronized void emitRecords() throws IOException {
for (String recordName : bufferedData.keySet()) {
RecordMap recordMap = bufferedData.get(recordName);
synchronized (recordMap) {
Set<Entry<TagMap, MetricMap>> entrySet = recordMap.entrySet ();
for (Entry<TagMap, MetricMap>... | [
"private",
"synchronized",
"void",
"emitRecords",
"(",
")",
"throws",
"IOException",
"{",
"for",
"(",
"String",
"recordName",
":",
"bufferedData",
".",
"keySet",
"(",
")",
")",
"{",
"RecordMap",
"recordMap",
"=",
"bufferedData",
".",
"get",
"(",
"recordName",
... | Emits the records. | [
"Emits",
"the",
"records",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java#L308-L320 |
119,592 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java | AbstractMetricsContext.sum | private Number sum(Number a, Number b) {
if (a instanceof Integer) {
return Integer.valueOf(a.intValue() + b.intValue());
}
else if (a instanceof Float) {
return new Float(a.floatValue() + b.floatValue());
}
else if (a instanceof Short) {
return Short.valueOf((short)(a.shor... | java | private Number sum(Number a, Number b) {
if (a instanceof Integer) {
return Integer.valueOf(a.intValue() + b.intValue());
}
else if (a instanceof Float) {
return new Float(a.floatValue() + b.floatValue());
}
else if (a instanceof Short) {
return Short.valueOf((short)(a.shor... | [
"private",
"Number",
"sum",
"(",
"Number",
"a",
",",
"Number",
"b",
")",
"{",
"if",
"(",
"a",
"instanceof",
"Integer",
")",
"{",
"return",
"Integer",
".",
"valueOf",
"(",
"a",
".",
"intValue",
"(",
")",
"+",
"b",
".",
"intValue",
"(",
")",
")",
"... | Adds two numbers, coercing the second to the type of the first. | [
"Adds",
"two",
"numbers",
"coercing",
"the",
"second",
"to",
"the",
"type",
"of",
"the",
"first",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java#L378-L399 |
119,593 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java | AbstractMetricsContext.parseAndSetPeriod | protected void parseAndSetPeriod(String attributeName) {
String periodStr = getAttribute(attributeName);
if (periodStr != null) {
int period = 0;
try {
period = Integer.parseInt(periodStr);
} catch (NumberFormatException nfe) {
}
if (period <= 0) {
throw ne... | java | protected void parseAndSetPeriod(String attributeName) {
String periodStr = getAttribute(attributeName);
if (periodStr != null) {
int period = 0;
try {
period = Integer.parseInt(periodStr);
} catch (NumberFormatException nfe) {
}
if (period <= 0) {
throw ne... | [
"protected",
"void",
"parseAndSetPeriod",
"(",
"String",
"attributeName",
")",
"{",
"String",
"periodStr",
"=",
"getAttribute",
"(",
"attributeName",
")",
";",
"if",
"(",
"periodStr",
"!=",
"null",
")",
"{",
"int",
"period",
"=",
"0",
";",
"try",
"{",
"per... | If a period is set in the attribute passed in, override
the default with it. | [
"If",
"a",
"period",
"is",
"set",
"in",
"the",
"attribute",
"passed",
"in",
"override",
"the",
"default",
"with",
"it",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java#L441-L454 |
119,594 | facebookarchive/hadoop-20 | src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java | AbstractMetricsContext.getAllRecords | @Override
public synchronized Map<String, Collection<OutputRecord>> getAllRecords() {
Map<String, Collection<OutputRecord>> out = new TreeMap<String, Collection<OutputRecord>>();
for (String recordName : bufferedData.keySet()) {
RecordMap recordMap = bufferedData.get(recordName);
synchronized... | java | @Override
public synchronized Map<String, Collection<OutputRecord>> getAllRecords() {
Map<String, Collection<OutputRecord>> out = new TreeMap<String, Collection<OutputRecord>>();
for (String recordName : bufferedData.keySet()) {
RecordMap recordMap = bufferedData.get(recordName);
synchronized... | [
"@",
"Override",
"public",
"synchronized",
"Map",
"<",
"String",
",",
"Collection",
"<",
"OutputRecord",
">",
">",
"getAllRecords",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"Collection",
"<",
"OutputRecord",
">",
">",
"out",
"=",
"new",
"TreeMap",
"<",
... | Retrieves all the records managed by this MetricsContext.
Useful for monitoring systems that are polling-based.
@return A non-null collection of all monitoring records. | [
"Retrieves",
"all",
"the",
"records",
"managed",
"by",
"this",
"MetricsContext",
".",
"Useful",
"for",
"monitoring",
"systems",
"that",
"are",
"polling",
"-",
"based",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/core/org/apache/hadoop/metrics/spi/AbstractMetricsContext.java#L461-L477 |
119,595 | facebookarchive/hadoop-20 | src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java | SimulatorTaskTracker.accept | @Override
public List<SimulatorEvent> accept(SimulatorEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("Accepted event " + event);
}
if (event instanceof HeartbeatEvent) {
return processHeartbeatEvent((HeartbeatEvent)event);
} else if (event instanceof TaskAttemptCompletionEvent) {
... | java | @Override
public List<SimulatorEvent> accept(SimulatorEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("Accepted event " + event);
}
if (event instanceof HeartbeatEvent) {
return processHeartbeatEvent((HeartbeatEvent)event);
} else if (event instanceof TaskAttemptCompletionEvent) {
... | [
"@",
"Override",
"public",
"List",
"<",
"SimulatorEvent",
">",
"accept",
"(",
"SimulatorEvent",
"event",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Accepted event \"",
"+",
"event",
")",
";",
"}",
... | Processes a simulation event.
@param event the event to process, should be an instance of HeartbeatEvent
or TaskAttemptCompletionEvent
@return the list of new events generated in response | [
"Processes",
"a",
"simulation",
"event",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java#L132-L146 |
119,596 | facebookarchive/hadoop-20 | src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java | SimulatorTaskTracker.init | public List<SimulatorEvent> init(long when) {
LOG.debug("TaskTracker starting up, current simulation time=" + when);
return Collections.<SimulatorEvent>singletonList(new HeartbeatEvent(this, when));
} | java | public List<SimulatorEvent> init(long when) {
LOG.debug("TaskTracker starting up, current simulation time=" + when);
return Collections.<SimulatorEvent>singletonList(new HeartbeatEvent(this, when));
} | [
"public",
"List",
"<",
"SimulatorEvent",
">",
"init",
"(",
"long",
"when",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"TaskTracker starting up, current simulation time=\"",
"+",
"when",
")",
";",
"return",
"Collections",
".",
"<",
"SimulatorEvent",
">",
"singletonList"... | Called once at the start of the simulation.
@param when Time when the task tracker starts.
@return the initial HeartbeatEvent for ourselves. | [
"Called",
"once",
"at",
"the",
"start",
"of",
"the",
"simulation",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java#L154-L158 |
119,597 | facebookarchive/hadoop-20 | src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java | SimulatorTaskTracker.finishRunningTask | private void finishRunningTask(TaskStatus finalStatus, long now) {
TaskAttemptID taskId = finalStatus.getTaskID();
if (LOG.isDebugEnabled()) {
LOG.debug("Finishing running task id=" + taskId + ", now=" + now);
}
SimulatorTaskInProgress tip = tasks.get(taskId);
if (tip == null) {
throw n... | java | private void finishRunningTask(TaskStatus finalStatus, long now) {
TaskAttemptID taskId = finalStatus.getTaskID();
if (LOG.isDebugEnabled()) {
LOG.debug("Finishing running task id=" + taskId + ", now=" + now);
}
SimulatorTaskInProgress tip = tasks.get(taskId);
if (tip == null) {
throw n... | [
"private",
"void",
"finishRunningTask",
"(",
"TaskStatus",
"finalStatus",
",",
"long",
"now",
")",
"{",
"TaskAttemptID",
"taskId",
"=",
"finalStatus",
".",
"getTaskID",
"(",
")",
";",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",... | Stops running a task attempt on the task tracker. It also updates the
number of available slots accordingly.
@param finalStatus the TaskStatus containing the task id and final
status of the task attempt. This rountine asserts a lot of the
finalStatus params, in case it is coming from a task attempt
completion event se... | [
"Stops",
"running",
"a",
"task",
"attempt",
"on",
"the",
"task",
"tracker",
".",
"It",
"also",
"updates",
"the",
"number",
"of",
"available",
"slots",
"accordingly",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java#L171-L238 |
119,598 | facebookarchive/hadoop-20 | src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java | SimulatorTaskTracker.processTaskAttemptCompletionEvent | private List<SimulatorEvent> processTaskAttemptCompletionEvent(
TaskAttemptCompletionEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("Processing task attempt completion event" + event);
}
long now = event.getTimeStamp();
TaskStatus finalStatus = event.getStatus();
TaskAttempt... | java | private List<SimulatorEvent> processTaskAttemptCompletionEvent(
TaskAttemptCompletionEvent event) {
if (LOG.isDebugEnabled()) {
LOG.debug("Processing task attempt completion event" + event);
}
long now = event.getTimeStamp();
TaskStatus finalStatus = event.getStatus();
TaskAttempt... | [
"private",
"List",
"<",
"SimulatorEvent",
">",
"processTaskAttemptCompletionEvent",
"(",
"TaskAttemptCompletionEvent",
"event",
")",
"{",
"if",
"(",
"LOG",
".",
"isDebugEnabled",
"(",
")",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Processing task attempt completion event... | Records that a task attempt has completed. Ignores the event for tasks
that got killed after the creation of the completion event.
@param event the TaskAttemptCompletionEvent the tracker sent to itself
@return the list of response events, empty | [
"Records",
"that",
"a",
"task",
"attempt",
"has",
"completed",
".",
"Ignores",
"the",
"event",
"for",
"tasks",
"that",
"got",
"killed",
"after",
"the",
"creation",
"of",
"the",
"completion",
"event",
"."
] | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java#L247-L261 |
119,599 | facebookarchive/hadoop-20 | src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java | SimulatorTaskTracker.createTaskAttemptCompletionEvent | private TaskAttemptCompletionEvent createTaskAttemptCompletionEvent(
SimulatorTaskInProgress tip, long now) {
// We need to clone() status as we modify and it goes into an Event
TaskStatus status = (TaskStatus)tip.getTaskStatus().clone();
long delta = tip.getUserSpaceR... | java | private TaskAttemptCompletionEvent createTaskAttemptCompletionEvent(
SimulatorTaskInProgress tip, long now) {
// We need to clone() status as we modify and it goes into an Event
TaskStatus status = (TaskStatus)tip.getTaskStatus().clone();
long delta = tip.getUserSpaceR... | [
"private",
"TaskAttemptCompletionEvent",
"createTaskAttemptCompletionEvent",
"(",
"SimulatorTaskInProgress",
"tip",
",",
"long",
"now",
")",
"{",
"// We need to clone() status as we modify and it goes into an Event",
"TaskStatus",
"status",
"=",
"(",
"TaskStatus",
")",
"tip",
"... | Creates a signal for itself marking the completion of a task attempt.
It assumes that the task attempt hasn't made any progress in the user
space code so far, i.e. it is called right at launch for map tasks and
immediately after all maps completed for reduce tasks.
@param tip the simulator task in progress
@param now ... | [
"Creates",
"a",
"signal",
"for",
"itself",
"marking",
"the",
"completion",
"of",
"a",
"task",
"attempt",
".",
"It",
"assumes",
"that",
"the",
"task",
"attempt",
"hasn",
"t",
"made",
"any",
"progress",
"in",
"the",
"user",
"space",
"code",
"so",
"far",
"i... | 2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4 | https://github.com/facebookarchive/hadoop-20/blob/2a29bc6ecf30edb1ad8dbde32aa49a317b4d44f4/src/contrib/mumak/src/java/org/apache/hadoop/mapred/SimulatorTaskTracker.java#L274-L291 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.