HADOOP-10404. Commit correct version of patch (cmccabe)
This commit is contained in:
parent
8099de259f
commit
687d83c9e1
@ -101,7 +101,7 @@ public interface Handler {
|
|||||||
*/
|
*/
|
||||||
private class NotificationHandler implements Handler {
|
private class NotificationHandler implements Handler {
|
||||||
public boolean handle(DomainSocket sock) {
|
public boolean handle(DomainSocket sock) {
|
||||||
lock.lock();
|
assert(lock.isHeldByCurrentThread());
|
||||||
try {
|
try {
|
||||||
if (LOG.isTraceEnabled()) {
|
if (LOG.isTraceEnabled()) {
|
||||||
LOG.trace(this + ": NotificationHandler: doing a read on " +
|
LOG.trace(this + ": NotificationHandler: doing a read on " +
|
||||||
@ -125,8 +125,6 @@ public boolean handle(DomainSocket sock) {
|
|||||||
}
|
}
|
||||||
closed = true;
|
closed = true;
|
||||||
return true;
|
return true;
|
||||||
} finally {
|
|
||||||
lock.unlock();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -349,15 +347,13 @@ public void remove(DomainSocket sock) {
|
|||||||
* Wake up the DomainSocketWatcher thread.
|
* Wake up the DomainSocketWatcher thread.
|
||||||
*/
|
*/
|
||||||
private void kick() {
|
private void kick() {
|
||||||
lock.lock();
|
assert(lock.isHeldByCurrentThread());
|
||||||
try {
|
try {
|
||||||
notificationSockets[0].getOutputStream().write(0);
|
notificationSockets[0].getOutputStream().write(0);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
if (!closed) {
|
if (!closed) {
|
||||||
LOG.error(this + ": error writing to notificationSockets[0]", e);
|
LOG.error(this + ": error writing to notificationSockets[0]", e);
|
||||||
}
|
}
|
||||||
} finally {
|
|
||||||
lock.unlock();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -467,12 +463,17 @@ public void run() {
|
|||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
LOG.error(toString() + " terminating on IOException", e);
|
LOG.error(toString() + " terminating on IOException", e);
|
||||||
} finally {
|
} finally {
|
||||||
kick(); // allow the handler for notificationSockets[0] to read a byte
|
lock.lock();
|
||||||
for (Entry entry : entries.values()) {
|
try {
|
||||||
sendCallback("close", entries, fdSet, entry.getDomainSocket().fd);
|
kick(); // allow the handler for notificationSockets[0] to read a byte
|
||||||
|
for (Entry entry : entries.values()) {
|
||||||
|
sendCallback("close", entries, fdSet, entry.getDomainSocket().fd);
|
||||||
|
}
|
||||||
|
entries.clear();
|
||||||
|
fdSet.close();
|
||||||
|
} finally {
|
||||||
|
lock.unlock();
|
||||||
}
|
}
|
||||||
entries.clear();
|
|
||||||
fdSet.close();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user