From 76f94d1e01fdcc4196fb0390863da46253502a36 Mon Sep 17 00:00:00 2001 From: nbhusare Date: Mon, 4 May 2020 16:00:53 +0530 Subject: [PATCH] Fixed the synchronization strategy Signed-off-by: nbhusare --- .../org/eclipse/xtext/ide/ExecutorServiceProvider.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/ExecutorServiceProvider.java b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/ExecutorServiceProvider.java index 6175cfd76b..6e60757b1c 100644 --- a/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/ExecutorServiceProvider.java +++ b/org.eclipse.xtext.ide/src/org/eclipse/xtext/ide/ExecutorServiceProvider.java @@ -9,13 +9,13 @@ package org.eclipse.xtext.ide; import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; import org.eclipse.xtext.util.DisposableRegistry; import org.eclipse.xtext.util.IDisposable; -import com.google.common.collect.Maps; import com.google.inject.Inject; import com.google.inject.Provider; import com.google.inject.Singleton; @@ -24,17 +24,18 @@ * Provider for executor services. By calling {@link #dispose()} all created executor services are shut down. *

* In some situations it is necessary to use multiple instances of executor services in order to avoid deadlocks. That - * can be achieved with the {@link #get(String)}�method, which will return a different instance for each key. + * can be achieved with the {@link #get(String)}�method, which will return a different instance for each key.

*/ @Singleton public class ExecutorServiceProvider implements Provider, IDisposable { + + private final Map instanceCache = new ConcurrentHashMap<>(3); + @Inject public void registerTo(DisposableRegistry disposableRegistry) { disposableRegistry.register(this); } - private final Map instanceCache = Maps.newHashMapWithExpectedSize(3); - @Override public ExecutorService get() { return get(null);