MAPREDUCE-3586. Modified CompositeService to avoid duplicate stop operations thereby solving race conditions in MR AM shutdown. (vinodkv)
git-svn-id: https://svn.apache.org/repos/asf/hadoop/common/trunk@1221950 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
55ad01711e
commit
ef9b974879
|
@ -352,6 +352,9 @@ Release 0.23.1 - Unreleased
|
||||||
MAPREDUCE-3588. Fixed bin/yarn which was broken by MAPREDUCE-3366 so that
|
MAPREDUCE-3588. Fixed bin/yarn which was broken by MAPREDUCE-3366 so that
|
||||||
yarn daemons can start. (Arun C Murthy via vinodkv)
|
yarn daemons can start. (Arun C Murthy via vinodkv)
|
||||||
|
|
||||||
|
MAPREDUCE-3586. Modified CompositeService to avoid duplicate stop operations
|
||||||
|
thereby solving race conditions in MR AM shutdown. (vinodkv)
|
||||||
|
|
||||||
Release 0.23.0 - 2011-11-01
|
Release 0.23.0 - 2011-11-01
|
||||||
|
|
||||||
INCOMPATIBLE CHANGES
|
INCOMPATIBLE CHANGES
|
||||||
|
|
|
@ -81,6 +81,10 @@ public class CompositeService extends AbstractService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void stop() {
|
public synchronized void stop() {
|
||||||
|
if (this.getServiceState() == STATE.STOPPED) {
|
||||||
|
// The base composite-service is already stopped, don't do anything again.
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (serviceList.size() > 0) {
|
if (serviceList.size() > 0) {
|
||||||
stop(serviceList.size() - 1);
|
stop(serviceList.size() - 1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,6 +88,14 @@ public class TestCompositeService {
|
||||||
((NUM_OF_SERVICES - 1) - i), services[i].getCallSequenceNumber());
|
((NUM_OF_SERVICES - 1) - i), services[i].getCallSequenceNumber());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Try to stop again. This should be a no-op.
|
||||||
|
serviceManager.stop();
|
||||||
|
// Verify that stop() call sequence numbers for every service don't change.
|
||||||
|
for (int i = 0; i < NUM_OF_SERVICES; i++) {
|
||||||
|
assertEquals("For " + services[i]
|
||||||
|
+ " service, stop() call sequence number should have been ",
|
||||||
|
((NUM_OF_SERVICES - 1) - i), services[i].getCallSequenceNumber());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -153,7 +161,7 @@ public class TestCompositeService {
|
||||||
|
|
||||||
serviceManager.start();
|
serviceManager.start();
|
||||||
|
|
||||||
// Start the composite service
|
// Stop the composite service
|
||||||
try {
|
try {
|
||||||
serviceManager.stop();
|
serviceManager.stop();
|
||||||
} catch (YarnException e) {
|
} catch (YarnException e) {
|
||||||
|
|
Loading…
Reference in New Issue