YARN-9096: Some GpuResourcePlugin and ResourcePluginManager methods are synchronized unnecessarily. Contributed by Gergely Pollak

(cherry picked from commit 742e30b473)
This commit is contained in:
Szilard Nemeth 2019-08-09 09:59:19 +02:00
parent 3bcf44f070
commit f0dfb8b832
2 changed files with 5 additions and 5 deletions

View File

@ -52,7 +52,7 @@ public class ResourcePluginManager {
private Map<String, ResourcePlugin> configuredPlugins = private Map<String, ResourcePlugin> configuredPlugins =
Collections.emptyMap(); Collections.emptyMap();
public synchronized void initialize(Context context) public void initialize(Context context)
throws YarnException { throws YarnException {
Configuration conf = context.getConf(); Configuration conf = context.getConf();
@ -108,7 +108,7 @@ public class ResourcePluginManager {
} }
} }
public synchronized void cleanup() throws YarnException { public void cleanup() throws YarnException {
for (ResourcePlugin plugin : configuredPlugins.values()) { for (ResourcePlugin plugin : configuredPlugins.values()) {
plugin.cleanup(); plugin.cleanup();
} }

View File

@ -54,7 +54,7 @@ public class GpuResourcePlugin implements ResourcePlugin {
} }
@Override @Override
public synchronized void initialize(Context context) throws YarnException { public void initialize(Context context) throws YarnException {
this.gpuDiscoverer.initialize(context.getConf()); this.gpuDiscoverer.initialize(context.getConf());
this.dockerCommandPlugin = this.dockerCommandPlugin =
GpuDockerCommandPluginFactory.createGpuDockerCommandPlugin( GpuDockerCommandPluginFactory.createGpuDockerCommandPlugin(
@ -62,7 +62,7 @@ public class GpuResourcePlugin implements ResourcePlugin {
} }
@Override @Override
public synchronized ResourceHandler createResourceHandler( public ResourceHandler createResourceHandler(
Context context, CGroupsHandler cGroupsHandler, Context context, CGroupsHandler cGroupsHandler,
PrivilegedOperationExecutor privilegedOperationExecutor) { PrivilegedOperationExecutor privilegedOperationExecutor) {
if (gpuResourceHandler == null) { if (gpuResourceHandler == null) {
@ -74,7 +74,7 @@ public class GpuResourcePlugin implements ResourcePlugin {
} }
@Override @Override
public synchronized NodeResourceUpdaterPlugin getNodeResourceHandlerInstance() { public NodeResourceUpdaterPlugin getNodeResourceHandlerInstance() {
return resourceDiscoverHandler; return resourceDiscoverHandler;
} }