YARN-8861. executorLock is misleading in ContainerLaunch. Contributed by Chandni Singh
This commit is contained in:
parent
ee816f1fd7
commit
e787d65a08
@ -135,7 +135,7 @@ public class ContainerLaunch implements Callable<Integer> {
|
|||||||
|
|
||||||
protected final LocalDirsHandlerService dirsHandler;
|
protected final LocalDirsHandlerService dirsHandler;
|
||||||
|
|
||||||
private final Lock containerExecLock = new ReentrantLock();
|
private final Lock launchLock = new ReentrantLock();
|
||||||
|
|
||||||
public ContainerLaunch(Context context, Configuration configuration,
|
public ContainerLaunch(Context context, Configuration configuration,
|
||||||
Dispatcher dispatcher, ContainerExecutor exec, Application app,
|
Dispatcher dispatcher, ContainerExecutor exec, Application app,
|
||||||
@ -485,11 +485,11 @@ protected int launchContainer(ContainerStartContext ctx)
|
|||||||
throws IOException, ConfigurationException {
|
throws IOException, ConfigurationException {
|
||||||
int launchPrep = prepareForLaunch(ctx);
|
int launchPrep = prepareForLaunch(ctx);
|
||||||
if (launchPrep == 0) {
|
if (launchPrep == 0) {
|
||||||
containerExecLock.lock();
|
launchLock.lock();
|
||||||
try {
|
try {
|
||||||
return exec.launchContainer(ctx);
|
return exec.launchContainer(ctx);
|
||||||
} finally {
|
} finally {
|
||||||
containerExecLock.unlock();
|
launchLock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return launchPrep;
|
return launchPrep;
|
||||||
@ -499,18 +499,18 @@ protected int relaunchContainer(ContainerStartContext ctx)
|
|||||||
throws IOException, ConfigurationException {
|
throws IOException, ConfigurationException {
|
||||||
int launchPrep = prepareForLaunch(ctx);
|
int launchPrep = prepareForLaunch(ctx);
|
||||||
if (launchPrep == 0) {
|
if (launchPrep == 0) {
|
||||||
containerExecLock.lock();
|
launchLock.lock();
|
||||||
try {
|
try {
|
||||||
return exec.relaunchContainer(ctx);
|
return exec.relaunchContainer(ctx);
|
||||||
} finally {
|
} finally {
|
||||||
containerExecLock.unlock();
|
launchLock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return launchPrep;
|
return launchPrep;
|
||||||
}
|
}
|
||||||
|
|
||||||
void reapContainer() throws IOException {
|
void reapContainer() throws IOException {
|
||||||
containerExecLock.lock();
|
launchLock.lock();
|
||||||
try {
|
try {
|
||||||
// Reap the container
|
// Reap the container
|
||||||
boolean result = exec.reapContainer(
|
boolean result = exec.reapContainer(
|
||||||
@ -524,7 +524,7 @@ void reapContainer() throws IOException {
|
|||||||
}
|
}
|
||||||
cleanupContainerFiles(getContainerWorkDir());
|
cleanupContainerFiles(getContainerWorkDir());
|
||||||
} finally {
|
} finally {
|
||||||
containerExecLock.unlock();
|
launchLock.unlock();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user