HDFS-2868. Expose xceiver counts via the DataNode MXBean. (harsh)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1240897 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Harsh J 2012-02-06 05:25:12 +00:00
parent c7007a8a35
commit da7b0d90c6
4 changed files with 15 additions and 2 deletions

View File

@ -298,6 +298,8 @@ Release 0.23.1 - UNRELEASED
HDFS-2857. Cleanup BlockInfo class. (suresh)
HDFS-2868. Expose xceiver counts via the DataNode MXBean. (harsh)
OPTIMIZATIONS
HDFS-2130. Switch default checksum to CRC32C. (todd)

View File

@ -1295,7 +1295,8 @@ public class DataNode extends Configured
}
/** Number of concurrent xceivers per node. */
int getXceiverCount() {
@Override // DataNodeMXBean
public int getXceiverCount() {
return threadGroup == null ? 0 : threadGroup.activeCount();
}

View File

@ -70,5 +70,10 @@ public interface DataNodeMXBean {
* @return the cluster id
*/
public String getClusterId();
/**
* Returns an estimate of the number of Datanode threads
* actively transferring blocks.
*/
public int getXceiverCount();
}

View File

@ -65,6 +65,11 @@ public class TestDataNodeMXBean {
String volumeInfo = (String)mbs.getAttribute(mxbeanName, "VolumeInfo");
Assert.assertEquals(replaceDigits(datanode.getVolumeInfo()),
replaceDigits(volumeInfo));
// Ensure mxbean's XceiverCount is same as the DataNode's
// live value.
int xceiverCount = (Integer)mbs.getAttribute(mxbeanName,
"XceiverCount");
Assert.assertEquals(datanode.getXceiverCount(), xceiverCount);
} finally {
if (cluster != null) {cluster.shutdown();}
}