HDFS-2454. svn merge -c 1204124 from trunk

git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/branches/branch-0.23@1204125 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Eli Collins 2011-11-20 04:29:40 +00:00
parent f1d346bf80
commit bab6e8adde
3 changed files with 12 additions and 8 deletions

View File

@ -22,6 +22,9 @@ Release 0.23.1 - UNRELEASED
HDFS-2568. Use a set to manage child sockets in XceiverServer.
(harsh via eli)
HDFS-2454. Move maxXceiverCount check to before starting the
thread in dataXceiver. (harsh via eli)
OPTIMIZATIONS
HDFS-2130. Switch default checksum to CRC32C. (todd)

View File

@ -165,14 +165,6 @@ class DataXceiver extends Receiver implements Runnable {
s.setSoTimeout(stdTimeout);
}
// Make sure the xceiver count is not exceeded
int curXceiverCount = datanode.getXceiverCount();
if (curXceiverCount > dataXceiverServer.maxXceiverCount) {
throw new IOException("xceiverCount " + curXceiverCount
+ " exceeds the limit of concurrent xcievers "
+ dataXceiverServer.maxXceiverCount);
}
opStartTime = now();
processOp(op);
++opsProcessed;

View File

@ -135,6 +135,15 @@ class DataXceiverServer implements Runnable {
try {
s = ss.accept();
s.setTcpNoDelay(true);
// Make sure the xceiver count is not exceeded
int curXceiverCount = datanode.getXceiverCount();
if (curXceiverCount > maxXceiverCount) {
throw new IOException("Xceiver count " + curXceiverCount
+ " exceeds the limit of concurrent xcievers: "
+ maxXceiverCount);
}
new Daemon(datanode.threadGroup, new DataXceiver(s, datanode, this))
.start();
} catch (SocketTimeoutException ignored) {