本文整理汇总了Java中com.intellij.util.containers.ConcurrentHashMap.put方法的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentHashMap.put方法的具体用法?Java ConcurrentHashMap.put怎么用?Java ConcurrentHashMap.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.containers.ConcurrentHashMap
的用法示例。
在下文中一共展示了ConcurrentHashMap.put方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getResourceBundle
import com.intellij.util.containers.ConcurrentHashMap; //导入方法依赖的package包/类
public static ResourceBundle getResourceBundle(@NotNull String pathToBundle, @NotNull ClassLoader loader) {
ConcurrentHashMap<String, SoftReference<ResourceBundle>> map = ourCache.get(loader);
SoftReference<ResourceBundle> reference = map.get(pathToBundle);
ResourceBundle result = reference == null ? null : reference.get();
if (result == null) {
map.put(pathToBundle, new SoftReference<ResourceBundle>(result = ResourceBundle.getBundle(pathToBundle, Locale.getDefault(), loader)));
}
return result;
}
示例2: internChildrenHolder
import com.intellij.util.containers.ConcurrentHashMap; //导入方法依赖的package包/类
private static <T extends DomChildDescriptionImpl> ChildrenDescriptionsHolder<T> internChildrenHolder(XmlFile file, ChildrenDescriptionsHolder<T> holder) {
SoftReference<ConcurrentHashMap<ChildrenDescriptionsHolder, ChildrenDescriptionsHolder>> ref = file.getUserData(HOLDERS_CACHE);
ConcurrentHashMap<ChildrenDescriptionsHolder, ChildrenDescriptionsHolder> cache = ref == null ? null : ref.get();
if (cache == null) {
cache = new ConcurrentHashMap<ChildrenDescriptionsHolder, ChildrenDescriptionsHolder>();
file.putUserData(HOLDERS_CACHE, new SoftReference<ConcurrentHashMap<ChildrenDescriptionsHolder, ChildrenDescriptionsHolder>>(cache));
}
ChildrenDescriptionsHolder existing = cache.get(holder);
if (existing != null) {
//noinspection unchecked
return existing;
}
cache.put(holder, holder);
return holder;
}
示例3: getDefaultNSDescriptor
import com.intellij.util.containers.ConcurrentHashMap; //导入方法依赖的package包/类
public XmlNSDescriptor getDefaultNSDescriptor(final String namespace, final boolean strict) {
long curExtResourcesModCount = ExternalResourceManagerEx.getInstanceEx().getModificationCount(getProject());
if (myExtResourcesModCount != curExtResourcesModCount) {
myDefaultDescriptorsCacheNotStrict.clear();
myDefaultDescriptorsCacheStrict.clear();
myExtResourcesModCount = curExtResourcesModCount;
}
final ConcurrentHashMap<String, CachedValue<XmlNSDescriptor>> defaultDescriptorsCache;
if (strict) {
defaultDescriptorsCache = myDefaultDescriptorsCacheStrict;
}
else {
defaultDescriptorsCache = myDefaultDescriptorsCacheNotStrict;
}
CachedValue<XmlNSDescriptor> cachedValue = defaultDescriptorsCache.get(namespace);
if (cachedValue == null) {
defaultDescriptorsCache.put(namespace, cachedValue = new PsiCachedValueImpl<XmlNSDescriptor>(getManager(), new CachedValueProvider<XmlNSDescriptor>() {
public Result<XmlNSDescriptor> compute() {
final XmlNSDescriptor defaultNSDescriptorInner = getDefaultNSDescriptorInner(namespace, strict);
if (isGeneratedFromDtd(defaultNSDescriptorInner)) {
return new Result<XmlNSDescriptor>(defaultNSDescriptorInner, XmlDocumentImpl.this, ExternalResourceManager.getInstance());
}
return new Result<XmlNSDescriptor>(defaultNSDescriptorInner, defaultNSDescriptorInner != null
? defaultNSDescriptorInner.getDependences()
: ExternalResourceManager.getInstance());
}
}));
}
return cachedValue.getValue();
}