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

This commit is contained in:
Szilard Nemeth 2019-08-09 09:59:19 +02:00
parent 72d7e570a7
commit 742e30b473
2 changed files with 5 additions and 5 deletions

View File

@ -65,7 +65,7 @@ public class ResourcePluginManager {
private DeviceMappingManager deviceMappingManager = null; private DeviceMappingManager deviceMappingManager = null;
public synchronized void initialize(Context context) public void initialize(Context context)
throws YarnException, ClassNotFoundException { throws YarnException, ClassNotFoundException {
Configuration conf = context.getConf(); Configuration conf = context.getConf();
Map<String, ResourcePlugin> pluginMap = new HashMap<>(); Map<String, ResourcePlugin> pluginMap = new HashMap<>();
@ -274,7 +274,7 @@ public class ResourcePluginManager {
return deviceMappingManager; return deviceMappingManager;
} }
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;
} }