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

Java ConcurrencyUtil类代码示例

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

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



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

示例1: createTypeByFQClassName

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@NotNull
@Override
public PsiClassType createTypeByFQClassName(@NotNull final String qName, @NotNull final GlobalSearchScope resolveScope) {
  if (CommonClassNames.JAVA_LANG_OBJECT.equals(qName)) {
    PsiClassType cachedObjectType = myCachedObjectType.get(resolveScope);
    if (cachedObjectType != null) {
      return cachedObjectType;
    }
    PsiClass aClass = JavaPsiFacade.getInstance(myManager.getProject()).findClass(CommonClassNames.JAVA_LANG_OBJECT, resolveScope);
    if (aClass != null) {
      cachedObjectType = new PsiImmediateClassType(aClass, PsiSubstitutor.EMPTY);
      cachedObjectType = ConcurrencyUtil.cacheOrGet(myCachedObjectType, resolveScope, cachedObjectType);
      return cachedObjectType;
    }
  }
  return new PsiClassReferenceType(createReferenceElementByFQClassName(qName, resolveScope), null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:PsiElementFactoryImpl.java


示例2: findClass

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@Override
public PsiClass findClass(@NotNull final String qualifiedName, @NotNull GlobalSearchScope scope) {
  ProgressIndicatorProvider.checkCanceled(); // We hope this method is being called often enough to cancel daemon processes smoothly

  Map<String, PsiClass> map = myClassCache.get(scope);
  if (map == null) {
    map = ContainerUtil.createConcurrentWeakValueMap();
    map = ConcurrencyUtil.cacheOrGet(myClassCache, scope, map);
  }
  PsiClass result = map.get(qualifiedName);
  if (result == null) {
    result = doFindClass(qualifiedName, scope);
    if (result != null) {
      map.put(qualifiedName, result);
    }
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:JavaPsiFacadeImpl.java


示例3: findPackage

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@Override
public PsiPackage findPackage(@NotNull String qualifiedName) {
  PsiPackage aPackage = myPackageCache.get(qualifiedName);
  if (aPackage != null) {
    return aPackage;
  }

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

  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:JavaPsiFacadeImpl.java


示例4: getOrCreateHighlightingSession

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@NotNull
static HighlightingSession getOrCreateHighlightingSession(@NotNull PsiFile psiFile,
                                                          @Nullable Editor editor,
                                                          @NotNull DaemonProgressIndicator progressIndicator,
                                                          @Nullable EditorColorsScheme editorColorsScheme) {
  HighlightingSession session = getHighlightingSession(psiFile, progressIndicator);
  if (session == null) {
    session = new HighlightingSessionImpl(psiFile, editor, progressIndicator, editorColorsScheme);
    ConcurrentMap<PsiFile, HighlightingSession> map = progressIndicator.getUserData(HIGHLIGHTING_SESSION);
    if (map == null) {
      map = progressIndicator.putUserDataIfAbsent(HIGHLIGHTING_SESSION, ContainerUtil.<PsiFile, HighlightingSession>newConcurrentMap());
    }
    session = ConcurrencyUtil.cacheOrGet(map, psiFile, session);
  }
  return session;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:HighlightingSessionImpl.java


示例5: create

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@NotNull
public static AttributesFlyweight create(Color foreground,
                                         Color background,
                                         @JdkConstants.FontStyle int fontType,
                                         Color effectColor,
                                         EffectType effectType,
                                         Color errorStripeColor) {
  FlyweightKey key = ourKey.get();
  if (key == null) {
    ourKey.set(key = new FlyweightKey());
  }
  key.foreground = foreground;
  key.background = background;
  key.fontType = fontType;
  key.effectColor = effectColor;
  key.effectType = effectType;
  key.errorStripeColor = errorStripeColor;

  AttributesFlyweight flyweight = entries.get(key);
  if (flyweight != null) {
    return flyweight;
  }

  AttributesFlyweight newValue = new AttributesFlyweight(foreground, background, fontType, effectColor, effectType, errorStripeColor);
  return ConcurrencyUtil.cacheOrGet(entries, key.clone(), newValue);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AttributesFlyweight.java


示例6: syncPublisher

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@Override
@NotNull
@SuppressWarnings({"unchecked"})
public <L> L syncPublisher(@NotNull final Topic<L> topic) {
  checkNotDisposed();
  L publisher = (L)mySyncPublishers.get(topic);
  if (publisher == null) {
    final Class<L> listenerClass = topic.getListenerClass();
    InvocationHandler handler = new InvocationHandler() {
      @Override
      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        sendMessage(new Message(topic, method, args));
        return NA;
      }
    };
    publisher = (L)Proxy.newProxyInstance(listenerClass.getClassLoader(), new Class[]{listenerClass}, handler);
    publisher = (L)ConcurrencyUtil.cacheOrGet(mySyncPublishers, topic, publisher);
  }
  return publisher;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:MessageBusImpl.java


示例7: asyncPublisher

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@Override
@NotNull
@SuppressWarnings({"unchecked"})
public <L> L asyncPublisher(@NotNull final Topic<L> topic) {
  checkNotDisposed();
  L publisher = (L)myAsyncPublishers.get(topic);
  if (publisher == null) {
    final Class<L> listenerClass = topic.getListenerClass();
    InvocationHandler handler = new InvocationHandler() {
      @Override
      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        postMessage(new Message(topic, method, args));
        return NA;
      }
    };
    publisher = (L)Proxy.newProxyInstance(listenerClass.getClassLoader(), new Class[]{listenerClass}, handler);
    publisher = (L)ConcurrencyUtil.cacheOrGet(myAsyncPublishers, topic, publisher);
  }
  return publisher;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:MessageBusImpl.java


示例8: findDirectoryImpl

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@Nullable
private PsiDirectory findDirectoryImpl(@NotNull VirtualFile vFile) {
  PsiDirectory psiDir = myVFileToPsiDirMap.get(vFile);
  if (psiDir != null) return psiDir;

  if (Registry.is("ide.hide.excluded.files")) {
    if (myFileIndex.isExcludedFile(vFile)) return null;
  }
  else {
    if (myFileIndex.isUnderIgnored(vFile)) return null;
  }

  VirtualFile parent = vFile.getParent();
  if (parent != null) { //?
    findDirectoryImpl(parent);// need to cache parent directory - used for firing events
  }

  psiDir = PsiDirectoryFactory.getInstance(myManager.getProject()).createDirectory(vFile);
  return ConcurrencyUtil.cacheOrGet(myVFileToPsiDirMap, vFile, psiDir);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:FileManagerImpl.java


示例9: getToolParentNode

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@NotNull
private InspectionTreeNode getToolParentNode(@NotNull String groupName, HighlightDisplayLevel errorLevel, boolean groupedBySeverity) {
  if (groupName.isEmpty()) {
    return getRelativeRootNode(groupedBySeverity, errorLevel);
  }
  ConcurrentMap<String, InspectionGroupNode> map = myGroups.get(errorLevel);
  if (map == null) {
    map = ConcurrencyUtil.cacheOrGet(myGroups, errorLevel, ContainerUtil.<String, InspectionGroupNode>newConcurrentMap());
  }
  InspectionGroupNode group;
  if (groupedBySeverity) {
    group = map.get(groupName);
  }
  else {
    group = null;
    for (Map<String, InspectionGroupNode> groupMap : myGroups.values()) {
      if ((group = groupMap.get(groupName)) != null) break;
    }
  }
  if (group == null) {
    group  = ConcurrencyUtil.cacheOrGet(map, groupName, new InspectionGroupNode(groupName));
    addChildNodeInEDT(getRelativeRootNode(groupedBySeverity, errorLevel), group);
  }
  return group;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:InspectionResultsView.java


示例10: getRelativeRootNode

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@NotNull
private InspectionTreeNode getRelativeRootNode(boolean isGroupedBySeverity, HighlightDisplayLevel level) {
  if (isGroupedBySeverity) {
    InspectionSeverityGroupNode severityGroupNode = mySeverityGroupNodes.get(level);
    if (severityGroupNode == null) {
      InspectionSeverityGroupNode newNode = new InspectionSeverityGroupNode(myProject, level);
      severityGroupNode = ConcurrencyUtil.cacheOrGet(mySeverityGroupNodes, level, newNode);
      if (severityGroupNode == newNode) {
        InspectionTreeNode root = myTree.getRoot();
        addChildNodeInEDT(root, severityGroupNode);
      }
    }
    return severityGroupNode;
  }
  return myTree.getRoot();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:InspectionResultsView.java


示例11: ApplicationLevelNumberConnectionsGuardImpl

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
public ApplicationLevelNumberConnectionsGuardImpl() {
  myDelay = DELAY;
  mySet = new HashSet<CachingSvnRepositoryPool>();
  myService = Executors.newSingleThreadScheduledExecutor(ConcurrencyUtil.newNamedThreadFactory("SVN connection"));
  myLock = new Object();
  myDisposed = false;
  myRecheck = new Runnable() {
    @Override
    public void run() {
      HashSet<CachingSvnRepositoryPool> pools = new HashSet<CachingSvnRepositoryPool>();
      synchronized (myLock) {
        pools.addAll(mySet);
      }
      for (CachingSvnRepositoryPool pool : pools) {
        pool.check();
      }
    }
  };
  myCurrentlyActiveConnections = 0;
  myCurrentlyOpenedConnections = 0;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:ApplicationLevelNumberConnectionsGuardImpl.java


示例12: getType

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@Nullable
public <T extends GroovyPsiElement> PsiType getType(@NotNull T element, @NotNull Function<T, PsiType> calculator) {
  PsiType type = myCalculatedTypes.get(element);
  if (type == null) {
    RecursionGuard.StackStamp stamp = ourGuard.markStack();
    type = calculator.fun(element);
    if (type == null) {
      type = UNKNOWN_TYPE;
    }
    if (stamp.mayCacheNow()) {
      type = ConcurrencyUtil.cacheOrGet(myCalculatedTypes, element, type);
    } else {
      final PsiType alreadyInferred = myCalculatedTypes.get(element);
      if (alreadyInferred != null) {
        type = alreadyInferred;
      }
    }
  }
  if (!type.isValid()) {
    error(element, type);
  }
  return UNKNOWN_TYPE == type ? null : type;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:GroovyPsiManager.java


示例13: createDebugProcessStarter

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@NotNull
private XDebugProcessStarter createDebugProcessStarter(@NotNull final TheRXProcessHandler processHandler,
                                                       @NotNull final ExecutionConsole executionConsole,
                                                       @NotNull final TheRDebugger debugger,
                                                       @NotNull final TheROutputReceiver outputReceiver,
                                                       @NotNull final TheRResolvingSession resolvingSession) {
  return new XDebugProcessStarter() {
    @NotNull
    @Override
    public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException {
      return new TheRDebugProcess(
        session,
        processHandler,
        executionConsole,
        debugger,
        outputReceiver,
        resolvingSession,
        ConcurrencyUtil.newSingleThreadExecutor(EXECUTOR_NAME)
      );
    }
  };
}
 
开发者ID:ktisha,项目名称:TheRPlugin,代码行数:23,代码来源:TheRDebugRunner.java


示例14: findPackage

import com.intellij.util.ConcurrencyUtil; //导入依赖的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


示例15: create

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@NotNull
public static AttributesFlyweight create(Color foreground,
                                         Color background,
                                         @JdkConstants.FontStyle int fontType,
                                         Color effectColor,
                                         EffectType effectType,
                                         Color errorStripeColor) {
  FlyweightKey key = ourKey.get();
  if (key == null) {
    ourKey.set(key = new FlyweightKey());
  }
  key.foreground = foreground;
  key.background = background;
  key.fontType = fontType;
  key.effectColor = effectColor;
  key.effectType = effectType;
  key.errorStripeColor = errorStripeColor;

  AttributesFlyweight flyweight = entries.get(key);
  if (flyweight != null) {
    return flyweight;
  }

  return ConcurrencyUtil.cacheOrGet(entries, key.clone(), new AttributesFlyweight(foreground, background, fontType, effectColor, effectType, errorStripeColor));
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:26,代码来源:AttributesFlyweight.java


示例16: getPsiInner

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@Override
protected PsiFile getPsiInner(@NotNull final Language target) {
  PsiFile file = myRoots.get(target);
  if (file == null) {
    if (isPhysical()) {
      VirtualFile virtualFile = getVirtualFile();
      if (isIgnored()) return null;
      VirtualFile parent = virtualFile.getParent();
      if (parent != null) {
        getManager().findDirectory(parent);
      }
    }
    file = createFile(target);
    if (file == null) return null;
    if (myOriginal != null) {
      final PsiFile originalFile = myOriginal.getPsi(target);
      if (originalFile != null) {
        ((PsiFileImpl)file).setOriginalFile(originalFile);
      }
    }
    file = ConcurrencyUtil.cacheOrGet(myRoots, target, file);
  }
  return file;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:25,代码来源:MultiplePsiFilesPerDocumentFileViewProvider.java


示例17: getType

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@Nullable
public <T extends GroovyPsiElement> PsiType getType(@NotNull T element, @NotNull Function<T, PsiType> calculator) {
  PsiType type = myCalculatedTypes.get(element);
  if (type == null) {
    RecursionGuard.StackStamp stamp = ourGuard.markStack();
    type = calculator.fun(element);
    if (type == null) {
      type = UNKNOWN_TYPE;
    }
    if (stamp.mayCacheNow()) {
      type = ConcurrencyUtil.cacheOrGet(myCalculatedTypes, element, type);
    } else {
      final PsiType alreadyInferred = myCalculatedTypes.get(element);
      if (alreadyInferred != null) {
        type = alreadyInferred;
      }
    }
  }
  if (!type.isValid()) {
    LOG.error("Type is invalid: " + type + "; element: " + element + " of class " + element.getClass());
  }
  return UNKNOWN_TYPE == type ? null : type;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:GroovyPsiManager.java


示例18: create

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@Nonnull
public static AttributesFlyweight create(Color foreground,
                                         Color background,
                                         @JdkConstants.FontStyle int fontType,
                                         Color effectColor,
                                         EffectType effectType,
                                         Color errorStripeColor) {
  FlyweightKey key = ourKey.get();
  if (key == null) {
    ourKey.set(key = new FlyweightKey());
  }
  key.foreground = foreground;
  key.background = background;
  key.fontType = fontType;
  key.effectColor = effectColor;
  key.effectType = effectType;
  key.errorStripeColor = errorStripeColor;

  AttributesFlyweight flyweight = entries.get(key);
  if (flyweight != null) {
    return flyweight;
  }

  AttributesFlyweight newValue = new AttributesFlyweight(foreground, background, fontType, effectColor, effectType, errorStripeColor);
  return ConcurrencyUtil.cacheOrGet(entries, key.clone(), newValue);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:AttributesFlyweight.java


示例19: syncPublisher

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@Override
@Nonnull
@SuppressWarnings("unchecked")
public <L> L syncPublisher(@Nonnull final Topic<L> topic) {
  checkNotDisposed();
  L publisher = (L)mySyncPublishers.get(topic);
  if (publisher == null) {
    final Class<L> listenerClass = topic.getListenerClass();
    InvocationHandler handler = new InvocationHandler() {
      @Override
      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        sendMessage(new Message(topic, method, args));
        return NA;
      }
    };
    publisher = (L)Proxy.newProxyInstance(listenerClass.getClassLoader(), new Class[]{listenerClass}, handler);
    publisher = (L)ConcurrencyUtil.cacheOrGet(mySyncPublishers, topic, publisher);
  }
  return publisher;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:MessageBusImpl.java


示例20: asyncPublisher

import com.intellij.util.ConcurrencyUtil; //导入依赖的package包/类
@Override
@Nonnull
@SuppressWarnings("unchecked")
public <L> L asyncPublisher(@Nonnull final Topic<L> topic) {
  checkNotDisposed();
  L publisher = (L)myAsyncPublishers.get(topic);
  if (publisher == null) {
    final Class<L> listenerClass = topic.getListenerClass();
    InvocationHandler handler = new InvocationHandler() {
      @Override
      public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
        postMessage(new Message(topic, method, args));
        return NA;
      }
    };
    publisher = (L)Proxy.newProxyInstance(listenerClass.getClassLoader(), new Class[]{listenerClass}, handler);
    publisher = (L)ConcurrencyUtil.cacheOrGet(myAsyncPublishers, topic, publisher);
  }
  return publisher;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:MessageBusImpl.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java SCryptUtil类代码示例发布时间:2022-05-22
下一篇:
Java FragmentHandler类代码示例发布时间: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