HDFS-2568. Use a set to manage child sockets in XceiverServer. Contributed by Harsh J
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1204122 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b2313021fd
commit
513718f92d
@ -124,6 +124,9 @@ Release 0.23.1 - UNRELEASED
|
||||
HDFS-208. name node should warn if only one dir is listed in dfs.name.dir.
|
||||
(Uma Maheswara Rao G via eli)
|
||||
|
||||
HDFS-2568. Use a set to manage child sockets in XceiverServer.
|
||||
(harsh via eli)
|
||||
|
||||
HDFS-2536. Remove unused imports. (harsh via eli)
|
||||
|
||||
OPTIMIZATIONS
|
||||
|
@ -126,7 +126,7 @@ private void updateCurrentThreadName(String status) {
|
||||
public void run() {
|
||||
int opsProcessed = 0;
|
||||
Op op = null;
|
||||
dataXceiverServer.childSockets.put(s, s);
|
||||
dataXceiverServer.childSockets.add(s);
|
||||
try {
|
||||
int stdTimeout = s.getSoTimeout();
|
||||
|
||||
|
@ -23,9 +23,9 @@
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.nio.channels.AsynchronousCloseException;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.hadoop.conf.Configuration;
|
||||
@ -48,8 +48,8 @@ class DataXceiverServer implements Runnable {
|
||||
ServerSocket ss;
|
||||
DataNode datanode;
|
||||
// Record all sockets opened for data transfer
|
||||
Map<Socket, Socket> childSockets = Collections.synchronizedMap(
|
||||
new HashMap<Socket, Socket>());
|
||||
Set<Socket> childSockets = Collections.synchronizedSet(
|
||||
new HashSet<Socket>());
|
||||
|
||||
/**
|
||||
* Maximal number of concurrent xceivers per node.
|
||||
@ -184,7 +184,7 @@ void kill() {
|
||||
|
||||
// close all the sockets that were accepted earlier
|
||||
synchronized (childSockets) {
|
||||
for (Iterator<Socket> it = childSockets.values().iterator();
|
||||
for (Iterator<Socket> it = childSockets.iterator();
|
||||
it.hasNext();) {
|
||||
Socket thissock = it.next();
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user