Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDennis Wagelaar2017-03-16 06:31:32 -0400
committerDennis Wagelaar2017-03-16 06:31:32 -0400
commit7c79824219dbfc472fc599c52f7f8a6d293e33c9 (patch)
treec32d6808085055c26fb0226004c2f83fbf170d52 /plugins/org.eclipse.m2m.atl.emftvm
parent2acccbbff542eee331b0b516d2f28c6c771b337a (diff)
downloadorg.eclipse.atl-7c79824219dbfc472fc599c52f7f8a6d293e33c9.tar.gz
org.eclipse.atl-7c79824219dbfc472fc599c52f7f8a6d293e33c9.tar.xz
org.eclipse.atl-7c79824219dbfc472fc599c52f7f8a6d293e33c9.zip
488223: EMFTVMUtil#getMethodSignature() causes method lookup collisions
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=488223
Diffstat (limited to 'plugins/org.eclipse.m2m.atl.emftvm')
-rw-r--r--plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java18
1 files changed, 11 insertions, 7 deletions
diff --git a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java
index a624e43b..dc67540c 100644
--- a/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java
+++ b/plugins/org.eclipse.m2m.atl.emftvm/src/org/eclipse/m2m/atl/emftvm/util/EMFTVMUtil.java
@@ -253,7 +253,7 @@ public final class EMFTVMUtil {
*
* @return the singleton instance of the Ecore metamodel
*/
- public static Metamodel getEcoreMetamodel() {
+ public static synchronized Metamodel getEcoreMetamodel() {
if (ecoreMetamodel == null) {
ecoreMetamodel = EmftvmFactory.eINSTANCE.createMetamodel();
ecoreMetamodel.setResource(EcorePackage.eINSTANCE.eResource());
@@ -266,7 +266,7 @@ public final class EMFTVMUtil {
*
* @return the singleton instance of the EMFTVM metamodel
*/
- public static Metamodel getEmfTvmMetamodel() {
+ public static synchronized Metamodel getEmfTvmMetamodel() {
if (emfTvmMetamodel == null) {
emfTvmMetamodel = EmftvmFactory.eINSTANCE.createMetamodel();
emfTvmMetamodel.setResource(EmftvmPackage.eINSTANCE.eResource());
@@ -279,7 +279,7 @@ public final class EMFTVMUtil {
*
* @return the singleton instance of the Trace metamodel
*/
- public static Metamodel getTraceMetamodel() {
+ public static synchronized Metamodel getTraceMetamodel() {
if (traceMetamodel == null) {
traceMetamodel = EmftvmFactory.eINSTANCE.createMetamodel();
traceMetamodel.setResource(TracePackage.eINSTANCE.eResource());
@@ -1960,8 +1960,10 @@ public final class EMFTVMUtil {
* @return <code>true</code> if the method cache contains the given caller and signature
*/
private static boolean hasCachedMethod(final Class<?> caller, final MethodSignature signature) {
- final Map<MethodSignature, Method> sigMap = METHOD_CACHE.get(caller);
- return (sigMap != null) && sigMap.containsKey(signature);
+ synchronized (METHOD_CACHE) {
+ final Map<MethodSignature, Method> sigMap = METHOD_CACHE.get(caller);
+ return (sigMap != null) && sigMap.containsKey(signature);
+ }
}
/**
@@ -1978,8 +1980,10 @@ public final class EMFTVMUtil {
* @author <a href="mailto:dennis.wagelaar@vub.ac.be">Dennis Wagelaar</a>
*/
private static Method findCachedMethod(final Class<?> caller, final MethodSignature signature) {
- final Map<MethodSignature, Method> sigMap = METHOD_CACHE.get(caller);
- return (sigMap != null) ? sigMap.get(signature) : null;
+ synchronized (METHOD_CACHE) {
+ final Map<MethodSignature, Method> sigMap = METHOD_CACHE.get(caller);
+ return (sigMap != null) ? sigMap.get(signature) : null;
+ }
}
/**

Back to the top