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-2857. Cleanup BlockInfo class. (suresh)
HDFS-2868. Expose xceiver counts via the DataNode MXBean. (harsh)
OPTIMIZATIONS OPTIMIZATIONS
HDFS-2130. Switch default checksum to CRC32C. (todd) HDFS-2130. Switch default checksum to CRC32C. (todd)

View File

@ -1295,7 +1295,8 @@ private void handleDiskError(String errMsgr) {
} }
/** Number of concurrent xceivers per node. */ /** Number of concurrent xceivers per node. */
int getXceiverCount() { @Override // DataNodeMXBean
public int getXceiverCount() {
return threadGroup == null ? 0 : threadGroup.activeCount(); return threadGroup == null ? 0 : threadGroup.activeCount();
} }

View File

@ -71,4 +71,9 @@ public interface DataNodeMXBean {
*/ */
public String getClusterId(); 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 void testDataNodeMXBean() throws Exception {
String volumeInfo = (String)mbs.getAttribute(mxbeanName, "VolumeInfo"); String volumeInfo = (String)mbs.getAttribute(mxbeanName, "VolumeInfo");
Assert.assertEquals(replaceDigits(datanode.getVolumeInfo()), Assert.assertEquals(replaceDigits(datanode.getVolumeInfo()),
replaceDigits(volumeInfo)); 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 { } finally {
if (cluster != null) {cluster.shutdown();} if (cluster != null) {cluster.shutdown();}
} }