*/
package org.opendaylight.yangtools.sal.binding.generator.impl;
+import com.google.common.base.Preconditions;
+
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.locks.Lock;
import javassist.ClassPool;
import org.opendaylight.yangtools.yang.model.api.ChoiceCaseNode;
import org.opendaylight.yangtools.yang.model.api.SchemaPath;
-import com.google.common.base.Preconditions;
-
/**
* Abstract base class which defines the baseline for the real {@link TransformerGenerator}.
* This class exists to expose the basic interface and common interactions with the rest
* will VerificationErrors.
*/
@Extension
- protected static final ClassLoadingStrategy CLASS_LOADING_STRATEGY =
- GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
+ protected static final ClassLoadingStrategy CLASS_LOADING_STRATEGY = GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy();
@Extension
protected final TypeResolver typeResolver;
@Extension
}
protected final <V> V runOnClassLoader(final ClassLoader cls, final Callable<V> function) throws Exception {
- final Lock lock = javAssist.getLock();
-
- lock.lock();
- try {
+ synchronized (javAssist) {
javAssist.appendClassLoaderIfMissing(cls);
return ClassLoaderUtils.withClassLoader(cls, function);
- } finally {
- lock.unlock();
}
}