• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ConcurrentHashMap类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.intellij.util.containers.ConcurrentHashMap的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentHashMap类的具体用法?Java ConcurrentHashMap怎么用?Java ConcurrentHashMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ConcurrentHashMap类属于com.intellij.util.containers包,在下文中一共展示了ConcurrentHashMap类的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: findPackage

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
@Override
public PsiPackage findPackage(@NotNull String qualifiedName) {
  SoftReference<ConcurrentMap<String, PsiPackage>> ref = myPackageCache;
  ConcurrentMap<String, PsiPackage> cache = ref == null ? null : ref.get();
  if (cache == null) {
    myPackageCache = new SoftReference<ConcurrentMap<String, PsiPackage>>(cache = new ConcurrentHashMap<String, PsiPackage>());
  }

  PsiPackage aPackage = cache.get(qualifiedName);
  if (aPackage != null) {
    return aPackage;
  }

  for (PsiElementFinder finder : filteredFinders()) {
    aPackage = finder.findPackage(qualifiedName);
    if (aPackage != null) {
      return ConcurrencyUtil.cacheOrGet(cache, qualifiedName, aPackage);
    }
  }

  return null;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:23,代码来源:JavaPsiFacadeImpl.java


示例2: findClassWithCache

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
@Nullable
public PsiClass findClassWithCache(@NotNull String fqName, @NotNull GlobalSearchScope resolveScope) {
  SoftReference<Map<GlobalSearchScope, PsiClass>> reference = myClassCache.get(fqName);
  Map<GlobalSearchScope, PsiClass> map = reference == null ? null : reference.get();
  if (map == null) {
    map = new ConcurrentHashMap<GlobalSearchScope, PsiClass>();
    myClassCache.put(fqName, new SoftReference<Map<GlobalSearchScope, PsiClass>>(map));
  }
  PsiClass cached = map.get(resolveScope);
  if (cached != null) {
    return cached;
  }

  PsiClass result = JavaPsiFacade.getInstance(myProject).findClass(fqName, resolveScope);
  if (result != null) {
    map.put(resolveScope, result);
  }
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:GroovyPsiManager.java


示例3: BuildTargetTypeState

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
public BuildTargetTypeState(BuildTargetType<?> targetType, BuildTargetsState state) {
  myTargetType = targetType;
  myTargetsState = state;
  myTargetsFile = new File(state.getDataPaths().getTargetTypeDataRoot(targetType), "targets.dat");
  myConfigurations = new ConcurrentHashMap<BuildTarget<?>, BuildTargetConfiguration>();
  myTargetIds = new HashMap<BuildTarget<?>, Integer>();
  load();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:9,代码来源:BuildTargetTypeState.java


示例4: BuildRootIndexImpl

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
public BuildRootIndexImpl(BuildTargetIndex targetIndex, JpsModel model, ModuleExcludeIndex index,
                          BuildDataPaths dataPaths, final IgnoredFileIndex ignoredFileIndex) {
  myIgnoredFileIndex = ignoredFileIndex;
  myRootsByTarget = new HashMap<BuildTarget<?>, List<? extends BuildRootDescriptor>>();
  myRootToDescriptors = new THashMap<File, List<BuildRootDescriptor>>(FileUtil.FILE_HASHING_STRATEGY);
  myFileFilters = new ConcurrentHashMap<BuildRootDescriptor, FileFilter>();
  final Iterable<AdditionalRootsProviderService> rootsProviders = JpsServiceManager.getInstance().getExtensions(AdditionalRootsProviderService.class);
  for (BuildTargetType<?> targetType : TargetTypeRegistry.getInstance().getTargetTypes()) {
    for (BuildTarget<?> target : targetIndex.getAllTargets(targetType)) {
      addRoots(dataPaths, rootsProviders, target, model, index, ignoredFileIndex);
    }
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:BuildRootIndexImpl.java


示例5: createMap

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
public static Map<SliceNode, Collection<PsiElement>> createMap() {
  return new FactoryMap<SliceNode, Collection<PsiElement>>() {
    @Override
    protected Map<SliceNode, Collection<PsiElement>> createMap() {
      return new ConcurrentHashMap<SliceNode, Collection<PsiElement>>(ContainerUtil.<SliceNode>identityStrategy());
    }

    @Override
    protected Collection<PsiElement> create(SliceNode key) {
      return new ConcurrentHashSet<PsiElement>(SliceLeafAnalyzer.LEAF_ELEMENT_EQUALITY);
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:SliceLeafAnalyzer.java


示例6: getMarkupModelMap

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
private static ConcurrentMap<Project, MarkupModelImpl> getMarkupModelMap(@NotNull Document document) {
  ConcurrentMap<Project, MarkupModelImpl> markupModelMap = document.getUserData(MARKUP_MODEL_MAP_KEY);
  if (markupModelMap == null) {
    synchronized (lock) {
      markupModelMap = document.getUserData(MARKUP_MODEL_MAP_KEY);
      if (markupModelMap == null) {
        markupModelMap = new ConcurrentHashMap<Project, MarkupModelImpl>();
        document.putUserData(MARKUP_MODEL_MAP_KEY, markupModelMap);
      }
      
    }
  }
  return markupModelMap;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:DocumentMarkupModel.java


示例7: 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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:10,代码来源:AbstractBundle.java


示例8: getCachedValue

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
public V getCachedValue(T key) {
  SofterReference<ConcurrentMap<T, V>> ref = myCache;
  ConcurrentMap<T, V> map = ref == null ? null : ref.get();
  if (map == null) {
    myCache = new SofterReference<ConcurrentMap<T, V>>(map = new ConcurrentHashMap<T, V>());
  }
  V value = map.get(key);
  if (value == null) {
    map.put(key, value = myValueProvider.fun(key));
  }
  return value;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:13,代码来源:SofterCache.java


示例9: 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;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:16,代码来源:DynamicGenericInfo.java


示例10: 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();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:35,代码来源:XmlDocumentImpl.java


示例11: FactorTree

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
public FactorTree(final Project project, GroovyDslExecutor executor) {
  myExecutor = executor;
  myProvider = new CachedValueProvider<Map>() {
    @Nullable
    @Override
    public Result<Map> compute() {
      return new Result<Map>(new ConcurrentHashMap(), PsiModificationTracker.MODIFICATION_COUNT, ProjectRootManager.getInstance(project));
    }
  };
  myTopLevelCache = CachedValuesManager.getManager(project).createCachedValue(myProvider, false);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:FactorTree.java


示例12: cache

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
public void cache(GroovyClassDescriptor descriptor, CustomMembersHolder holder) {
  Map current = null;
  for (Factor factor : descriptor.affectingFactors) {
    Object key;
    switch (factor) {
      case placeElement: key = descriptor.getPlace(); break;
      case placeFile: key = descriptor.getPlaceFile(); break;
      case qualifierType: key = descriptor.getTypeText(); break;
      default: throw new IllegalStateException("Unknown variant: "+ factor);
    }
    if (current == null) {
      if (key instanceof UserDataHolder) {
        final Project project = descriptor.getProject();
        current = CachedValuesManager.getManager(project).getCachedValue((UserDataHolder)key, GDSL_MEMBER_CACHE, myProvider, false);
        continue;
      }

      current = myTopLevelCache.getValue();
    }
    Map next = (Map)current.get(key);
    if (next == null) {
      //noinspection unchecked
      current.put(key, next = new ConcurrentHashMap());
    }
    current = next;
  }

  if (current == null) current = myTopLevelCache.getValue();
  //noinspection unchecked
  current.put(myExecutor, holder);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:32,代码来源:FactorTree.java


示例13: getCachedType

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
public static PsiType getCachedType(String typeText, PsiFile context) {
  Map<String, PsiType> map = context.getUserData(CACHED_TYPES);
  if (map == null) {
    map = new ConcurrentHashMap<String, PsiType>();
    context.putUserData(CACHED_TYPES, map);
  }
  PsiType type = map.get(typeText);
  if (type == null || !type.isValid()) {
    type = JavaPsiFacade.getElementFactory(context.getProject()).createTypeFromText(typeText, context);
    map.put(typeText, type);
  }
  return type;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:14,代码来源:ClassContextFilter.java


示例14: compute

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
@Override
protected CachedValue<Map<String, JSImportedElementResolveResult>> compute(final PsiElement psiElement, final Object p)
{
	return CachedValuesManager.getManager(psiElement.getProject()).createCachedValue(new CachedValueProvider<Map<String, JSImportedElementResolveResult>>()
	{
		@Override
		public Result<Map<String, JSImportedElementResolveResult>> compute()
		{
			return new Result<Map<String, JSImportedElementResolveResult>>(new ConcurrentHashMap<String, JSImportedElementResolveResult>(), PsiModificationTracker.MODIFICATION_COUNT);
		}
	}, false);
}
 
开发者ID:consulo,项目名称:consulo-javascript,代码行数:13,代码来源:JSImportHandlingUtil.java


示例15: create

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
@Override
protected ConcurrentHashMap<String, SoftReference<ResourceBundle>> create(ClassLoader key) {
  return new ConcurrentHashMap<String, SoftReference<ResourceBundle>>();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:AbstractBundle.java


示例16: CachesHolder

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
public CachesHolder(final Project project, final RepositoryLocationCache locationCache) {
  myProject = project;
  myLocationCache = locationCache;
  myPlManager = ProjectLevelVcsManager.getInstance(myProject);
  myCacheFiles = new ConcurrentHashMap<String, ChangesCacheFile>();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:7,代码来源:CachesHolder.java


示例17: CommittedChangesCache

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
public CommittedChangesCache(final Project project, final MessageBus bus, final ProjectLevelVcsManager vcsManager) {
  myProject = project;
  myBus = bus;
  myConnection = myBus.connect();
  final VcsListener vcsListener = new VcsListener() {
    @Override
    public void directoryMappingChanged() {
      myLocationCache.reset();
      refreshAllCachesAsync(false, true);
      refreshIncomingChangesAsync();
      myTaskQueue.run(new Runnable() {
        @Override
        public void run() {
          final List<ChangesCacheFile> files = myCachesHolder.getAllCaches();
          for (ChangesCacheFile file : files) {
            final RepositoryLocation location = file.getLocation();
            fireChangesLoaded(location, Collections.<CommittedChangeList>emptyList());
          }
          fireIncomingReloaded();
        }
      });
    }
  };
  myLocationCache = new RepositoryLocationCache(project);
  myCachesHolder = new CachesHolder(project, myLocationCache);
  myTaskQueue = new ProgressManagerQueue(project, VcsBundle.message("committed.changes.refresh.progress"));
  ((ProjectLevelVcsManagerImpl) vcsManager).addInitializationRequest(VcsInitObject.COMMITTED_CHANGES_CACHE, new Runnable() {
    @Override
    public void run() {
      ApplicationManager.getApplication().runReadAction(new Runnable() {
        @Override
        public void run() {
          if (myProject.isDisposed()) return;
          myTaskQueue.start();
          myConnection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED, vcsListener);
          myConnection.subscribe(ProjectLevelVcsManager.VCS_CONFIGURATION_CHANGED_IN_PLUGIN, vcsListener);
        }
      });
    }
  });
  myVcsManager = vcsManager;
  Disposer.register(project, new Disposable() {
    @Override
    public void dispose() {
      cancelRefreshTimer();
      myConnection.disconnect();
    }
  });
  myExternallyLoadedChangeLists = new ConcurrentHashMap<String, Pair<Long, List<CommittedChangeList>>>();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:51,代码来源:CommittedChangesCache.java


示例18: create

import com.intellij.util.containers.ConcurrentHashMap; //导入依赖的package包/类
public Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> create() {
  return new ConcurrentHashMap<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>>();
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:4,代码来源:DomElementsProblemsHolderImpl.java



注:本文中的com.intellij.util.containers.ConcurrentHashMap类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ClusteringMessage类代码示例发布时间:2022-05-22
下一篇:
Java WrappedFailoverProxyProvider类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap