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

Java AtomicNotNullLazyValue类代码示例

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

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



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

示例1: cleanTargetStorages

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public void cleanTargetStorages(BuildTarget<?> target) throws IOException {
  try {
    AtomicNotNullLazyValue<BuildTargetStorages> storages = myTargetStorages.remove(target);
    if (storages != null) {
      storages.getValue().close();
    }
  }
  finally {
    // delete all data except src-out mapping which is cleaned in a special way
    final File[] targetData = myDataPaths.getTargetDataRoot(target).listFiles();
    if (targetData != null) {
      final File srcOutputMapRoot = getSourceToOutputMapRoot(target);
      for (File dataFile : targetData) {
        if (!FileUtil.filesEqual(dataFile, srcOutputMapRoot)) {
          FileUtil.delete(dataFile);
        }
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:BuildDataManager.java


示例2: closeSourceToOutputStorages

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
private void closeSourceToOutputStorages() throws IOException {
  IOException ex = null;
  try {
    for (AtomicNotNullLazyValue<SourceToOutputMappingImpl> mapping : mySourceToOutputs.values()) {
      try {
        mapping.getValue().close();
      }
      catch (IOException e) {
        if (ex == null) {
          ex = e;
        }
      }
    }
  }
  finally {
    mySourceToOutputs.clear();
  }
  if (ex != null) {
    throw ex;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:BuildDataManager.java


示例3: fetchValue

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
private static <K, V> V fetchValue(ConcurrentMap<K, AtomicNotNullLazyValue<V>> container, K key, final LazyValueFactory<K, V> valueFactory) throws IOException {
  AtomicNotNullLazyValue<V> lazy = container.get(key);
  if (lazy == null) {
    final AtomicNotNullLazyValue<V> newValue = valueFactory.create(key);
    lazy = container.putIfAbsent(key, newValue);
    if (lazy == null) {
      lazy = newValue; // just initialized
    }
  }
  try {
    return lazy.getValue();
  }
  catch (BuildDataCorruptedException e) {
    throw e.getCause();
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:BuildDataManager.java


示例4: ClsReferenceListImpl

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsReferenceListImpl(@NotNull PsiClassReferenceListStub stub) {
  super(stub);
  myRefs = new AtomicNotNullLazyValue<ClsJavaCodeReferenceElementImpl[]>() {
    @NotNull
    @Override
    protected ClsJavaCodeReferenceElementImpl[] compute() {
      String[] strings = getStub().getReferencedNames();
      if (strings.length > 0) {
        ClsJavaCodeReferenceElementImpl[] refs = new ClsJavaCodeReferenceElementImpl[strings.length];
        for (int i = 0; i < strings.length; i++) {
          refs[i] = new ClsJavaCodeReferenceElementImpl(ClsReferenceListImpl.this, strings[i]);
        }
        return refs;
      }
      else {
        return EMPTY_REFS_ARRAY;
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:ClsReferenceListImpl.java


示例5: ClsMemberImpl

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
protected ClsMemberImpl(T stub) {
  super(stub);
  myDocComment = !isDeprecated() ? null : new AtomicNotNullLazyValue<PsiDocComment>() {
    @NotNull
    @Override
    protected PsiDocComment compute() {
      return new ClsDocCommentImpl(ClsMemberImpl.this);
    }
  };
  myNameIdentifier = new AtomicNotNullLazyValue<PsiIdentifier>() {
    @NotNull
    @Override
    protected PsiIdentifier compute() {
      return new ClsIdentifierImpl(ClsMemberImpl.this, getName());
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:ClsMemberImpl.java


示例6: ClsAnnotationImpl

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsAnnotationImpl(final PsiAnnotationStub stub) {
  super(stub);
  myReferenceElement = new AtomicNotNullLazyValue<ClsJavaCodeReferenceElementImpl>() {
    @NotNull
    @Override
    protected ClsJavaCodeReferenceElementImpl compute() {
      String annotationText = getStub().getText();
      int index = annotationText.indexOf('(');
      String refText = index > 0 ? annotationText.substring(1, index) : annotationText.substring(1);
      return new ClsJavaCodeReferenceElementImpl(ClsAnnotationImpl.this, refText);
    }
  };
  myParameterList = new AtomicNotNullLazyValue<ClsAnnotationParameterListImpl>() {
    @NotNull
    @Override
    protected ClsAnnotationParameterListImpl compute() {
      PsiNameValuePair[] attrs = getStub().getText().indexOf('(') > 0
          ? PsiTreeUtil.getRequiredChildOfType(getStub().getPsiElement(), PsiAnnotationParameterList.class).getAttributes()
          : PsiNameValuePair.EMPTY_ARRAY;
      return new ClsAnnotationParameterListImpl(ClsAnnotationImpl.this, attrs);
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:ClsAnnotationImpl.java


示例7: ClsTypeElementImpl

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance) {
  myParent = parent;
  myTypeText = TypeInfo.internFrequentType(typeText);
  myVariance = variance;
  myChild = new AtomicNullableLazyValue<ClsElementImpl>() {
    @Override
    protected ClsElementImpl compute() {
      return calculateChild();
    }
  };
  myCachedType = new AtomicNotNullLazyValue<PsiType>() {
    @NotNull
    @Override
    protected PsiType compute() {
      return calculateType();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:ClsTypeElementImpl.java


示例8: getValue

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
@NotNull
public NotNullLazyValue<?> getValue() {
  if (value == null) {
    value = new AtomicNotNullLazyValue<Object>() {
      @NotNull
      @Override
      protected Object compute() {
        try {
          if (service == null) {
            Class<Object> aClass = findClass(implementation);
            return asInstance ? instantiate(aClass, ApplicationManager.getApplication().getPicoContainer(), true) : aClass;
          }
          else {
            return ServiceManager.getService(findClass(service));
          }
        }
        catch (ClassNotFoundException e) {
          throw new RuntimeException(e);
        }
      }
    };
  }
  return value;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:JsonRpcDomainBean.java


示例9: fetchValue

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
private static <K, V> V fetchValue(ConcurrentMap<K, AtomicNotNullLazyValue<V>> container, K key, final LazyValueFactory<K, V> valueFactory) throws IOException {
  AtomicNotNullLazyValue<V> lazy = container.get(key);
  if (lazy == null) {
    final AtomicNotNullLazyValue<V> newValue = valueFactory.create(key);
    lazy = container.putIfAbsent(key, newValue);
    if (lazy == null) {
      lazy = newValue; // just initialized
    }
  }
  try {
    return lazy.getValue();
  }
  catch (RuntimeException e) {
    final Throwable cause = e.getCause();
    if (cause instanceof IOException) {
      throw (IOException)cause;
    }
    throw e;
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:BuildDataManager.java


示例10: ClsAnnotationImpl

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsAnnotationImpl(final PsiAnnotationStub stub) {
  super(stub);
  myReferenceElement = new AtomicNotNullLazyValue<ClsJavaCodeReferenceElementImpl>() {
    @NotNull
    @Override
    protected ClsJavaCodeReferenceElementImpl compute() {
      String text = PsiTreeUtil.getRequiredChildOfType(getStub().getPsiElement(), PsiJavaCodeReferenceElement.class).getText();
      return new ClsJavaCodeReferenceElementImpl(ClsAnnotationImpl.this, text);
    }
  };
  myParameterList = new AtomicNotNullLazyValue<ClsAnnotationParameterListImpl>() {
    @NotNull
    @Override
    protected ClsAnnotationParameterListImpl compute() {
      PsiAnnotationParameterList paramList = PsiTreeUtil.getRequiredChildOfType(getStub().getPsiElement(), PsiAnnotationParameterList.class);
      return new ClsAnnotationParameterListImpl(ClsAnnotationImpl.this, paramList.getAttributes());
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:ClsAnnotationImpl.java


示例11: ClsTypeElementImpl

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance) {
  myParent = parent;
  myTypeText = TypeInfo.internFrequentType(typeText);
  myVariance = variance;
  myChild = new VolatileNullableLazyValue<ClsElementImpl>() {
    @Nullable
    @Override
    protected ClsElementImpl compute() {
      return calculateChild();
    }
  };
  myCachedType = new AtomicNotNullLazyValue<PsiType>() {
    @NotNull
    @Override
    protected PsiType compute() {
      return calculateType();
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:ClsTypeElementImpl.java


示例12: ConfigurableEP

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
protected ConfigurableEP(PicoContainer picoContainer, @Nullable Project project) {
  myProject = project;
  myPicoContainer = picoContainer;
  myFactory = new AtomicNotNullLazyValue<NullableFactory<T>>() {
    @NotNull
    @Override
    protected NullableFactory<T> compute() {
      if (providerClass != null) {
        return new InstanceFromProviderFactory();
      }
      else if (instanceClass != null) {
        return new NewInstanceFactory();
      }
      else if (implementationClass != null) {
        return new ImplementationFactory();
      }
      throw new RuntimeException();
    }
  };
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:21,代码来源:ConfigurableEP.java


示例13: ConfigurableEP

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
protected ConfigurableEP(PicoContainer picoContainer, @Nullable Project project) {
  myProject = project;
  myPicoContainer = picoContainer;
  myFactory = new AtomicNotNullLazyValue<NullableFactory<T>>() {
    @Nonnull
    @Override
    protected NullableFactory<T> compute() {
      if (providerClass != null) {
        return new InstanceFromProviderFactory();
      }
      else if (instanceClass != null) {
        return new NewInstanceFactory();
      }
      else if (implementationClass != null) {
        return new ImplementationFactory();
      }
      throw new RuntimeException();
    }
  };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:21,代码来源:ConfigurableEP.java


示例14: ClsReferenceListImpl

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsReferenceListImpl(@NotNull PsiClassReferenceListStub stub)
{
	super(stub);
	myRefs = new AtomicNotNullLazyValue<ClsJavaCodeReferenceElementImpl[]>()
	{
		@NotNull
		@Override
		protected ClsJavaCodeReferenceElementImpl[] compute()
		{
			String[] strings = getStub().getReferencedNames();
			if(strings.length > 0)
			{
				ClsJavaCodeReferenceElementImpl[] refs = new ClsJavaCodeReferenceElementImpl[strings.length];
				for(int i = 0; i < strings.length; i++)
				{
					refs[i] = new ClsJavaCodeReferenceElementImpl(ClsReferenceListImpl.this, strings[i]);
				}
				return refs;
			}
			else
			{
				return EMPTY_REFS_ARRAY;
			}
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:27,代码来源:ClsReferenceListImpl.java


示例15: ClsMemberImpl

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
protected ClsMemberImpl(T stub)
{
	super(stub);
	myDocComment = !stub.isDeprecated() ? null : new AtomicNotNullLazyValue<PsiDocComment>()
	{
		@NotNull
		@Override
		protected PsiDocComment compute()
		{
			return new ClsDocCommentImpl(ClsMemberImpl.this);
		}
	};
	myNameIdentifier = new AtomicNotNullLazyValue<PsiIdentifier>()
	{
		@NotNull
		@Override
		protected PsiIdentifier compute()
		{
			return new ClsIdentifierImpl(ClsMemberImpl.this, getName());
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:ClsMemberImpl.java


示例16: ClsPackageAccessibilityStatementImpl

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsPackageAccessibilityStatementImpl(PsiPackageAccessibilityStatementStub stub)
{
	super(stub);
	myPackageReference = new AtomicNullableLazyValue<PsiJavaCodeReferenceElement>()
	{
		@Override
		protected PsiJavaCodeReferenceElement compute()
		{
			String packageName = getPackageName();
			return packageName != null ? new ClsJavaCodeReferenceElementImpl(ClsPackageAccessibilityStatementImpl.this, packageName) : null;
		}
	};
	myModuleReferences = new AtomicNotNullLazyValue<Iterable<PsiJavaModuleReferenceElement>>()
	{
		@NotNull
		@Override
		protected Iterable<PsiJavaModuleReferenceElement> compute()
		{
			return ContainerUtil.map(getStub().getTargets(), target -> new ClsJavaModuleReferenceElementImpl(ClsPackageAccessibilityStatementImpl.this, target));
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:23,代码来源:ClsPackageAccessibilityStatementImpl.java


示例17: ClsTypeElementImpl

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public ClsTypeElementImpl(@NotNull PsiElement parent, @NotNull String typeText, char variance)
{
	myParent = parent;
	myTypeText = TypeInfo.internFrequentType(typeText);
	myVariance = variance;
	myChild = new AtomicNullableLazyValue<ClsElementImpl>()
	{
		@Override
		protected ClsElementImpl compute()
		{
			return calculateChild();
		}
	};
	myCachedType = new AtomicNotNullLazyValue<PsiType>()
	{
		@NotNull
		@Override
		protected PsiType compute()
		{
			return calculateType();
		}
	};
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:24,代码来源:ClsTypeElementImpl.java


示例18: create

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
@Override
public AtomicNotNullLazyValue<SourceToOutputMappingImpl> create(final BuildTarget<?> key) {
  return new AtomicNotNullLazyValue<SourceToOutputMappingImpl>() {
    @NotNull
    @Override
    protected SourceToOutputMappingImpl compute() {
      try {
        return new SourceToOutputMappingImpl(new File(getSourceToOutputMapRoot(key), "data"));
      }
      catch (IOException e) {
        throw new BuildDataCorruptedException(e);
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:BuildDataManager.java


示例19: flush

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
public void flush(boolean memoryCachesOnly) {
  myTargetStoragesOwner.flush(memoryCachesOnly);
  for (AtomicNotNullLazyValue<SourceToOutputMappingImpl> mapping : mySourceToOutputs.values()) {
    mapping.getValue().flush(memoryCachesOnly);
  }
  myOutputToTargetRegistry.flush(memoryCachesOnly);
  mySrcToFormMap.flush(memoryCachesOnly);
  final Mappings mappings = myMappings;
  if (mappings != null) {
    synchronized (mappings) {
      mappings.flush(memoryCachesOnly);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:BuildDataManager.java


示例20: ConfigurableEP

import com.intellij.openapi.util.AtomicNotNullLazyValue; //导入依赖的package包/类
protected ConfigurableEP(PicoContainer picoContainer, @Nullable Project project) {
  myProject = project;
  myPicoContainer = picoContainer;
  myProducer = new AtomicNotNullLazyValue<ObjectProducer>() {
    @NotNull
    @Override
    protected ObjectProducer compute() {
      try {
        if (providerClass != null) {
          return new ProviderProducer((ConfigurableProvider)instantiate(providerClass, myPicoContainer));
        }
        if (instanceClass != null) {
          return new ClassProducer(myPicoContainer, findClass(instanceClass));
        }
        if (implementationClass != null) {
          return new ClassProducer(myPicoContainer, findClass(implementationClass));
        }
        throw new RuntimeException("configurable class name is not set");
      }
      catch (AssertionError error) {
        LOG.error(error);
      }
      catch (LinkageError error) {
        LOG.error(error);
      }
      catch (Exception exception) {
        LOG.error(exception);
      }
      return new ObjectProducer();
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:33,代码来源:ConfigurableEP.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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