HDFS-2868. svn merge -c 1240897 from trunk

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1240899 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Harsh J 2012-02-06 05:37:36 +00:00
parent 3f78abc546
commit ce01f2ab1d
4 changed files with 14 additions and 7 deletions

View File

@ -101,11 +101,7 @@ Release 0.23.1 - UNRELEASED
HDFS-2814. NamenodeMXBean does not account for svn revision in the version HDFS-2814. NamenodeMXBean does not account for svn revision in the version
information. (Hitesh Shah via jitendra) information. (Hitesh Shah via jitendra)
HDFS-2784. Update hftp and hdfs for host-based token support. HDFS-2868. Expose xceiver counts via the DataNode MXBean. (harsh)
(Kihwal Lee via jitendra)
HDFS-2785. Update webhdfs and httpfs for host-based token support.
(Robert Joseph Evans via jitendra)
OPTIMIZATIONS OPTIMIZATIONS

View File

@ -1262,7 +1262,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();}
} }