提交 b6a75caa 编写于 作者: S Sam Judd

Fix race in TranscoderRegistry.

Fixes #191.
上级 fe42c381
......@@ -44,8 +44,11 @@ public class TranscoderRegistry {
// we know they're the same type (Z and R)
return (ResourceTranscoder<Z, R>) UnitTranscoder.get();
}
GET_KEY.set(decodedClass, transcodedClass);
ResourceTranscoder<?, ?> result = factories.get(GET_KEY);
final ResourceTranscoder<?, ?> result;
synchronized (GET_KEY) {
GET_KEY.set(decodedClass, transcodedClass);
result = factories.get(GET_KEY);
}
if (result == null) {
throw new IllegalArgumentException("No transcoder registered for " + decodedClass + " and "
+ transcodedClass);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册