本文整理汇总了Java中org.apache.commons.lang3.concurrent.ConcurrentException类的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentException类的具体用法?Java ConcurrentException怎么用?Java ConcurrentException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConcurrentException类属于org.apache.commons.lang3.concurrent包,在下文中一共展示了ConcurrentException类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: handlePotentialStuckRepairs
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
private void handlePotentialStuckRepairs(LazyInitializer<Set<String>> busyHosts, String hostName)
throws ConcurrentException {
if (!busyHosts.get().contains(hostName) && context.storage instanceof IDistributedStorage) {
try (JmxProxy hostProxy
= context.jmxConnectionFactory.connect(hostName, context.config.getJmxConnectionTimeoutInSeconds())) {
// We double check that repair is still running there before actually canceling repairs
if (hostProxy.isRepairRunning()) {
LOG.warn(
"A host ({}) reported that it is involved in a repair, but there is no record "
+ "of any ongoing repair involving the host. Sending command to abort all repairs "
+ "on the host.",
hostName);
hostProxy.cancelAllRepairs();
hostProxy.close();
}
} catch (ReaperException | RuntimeException | InterruptedException | JMException e) {
LOG.debug("failed to cancel repairs on host {}", hostName, e);
}
}
}
开发者ID:thelastpickle,项目名称:cassandra-reaper,代码行数:22,代码来源:SegmentRunner.java
示例2: lazy
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
/**
* Use a supplier to perform lazy instantiation of a value. Wraps the given
* supplier in a new Supplier that has the lazy loading logic.
*/
public static <T> Supplier<T> lazy(Supplier<T> source) {
return new Supplier<T>() {
final LazyInitializer<T> init = new LazyInitializer<T>() {
@Override
protected T initialize() throws ConcurrentException {
return source.get();
}
};
@Override
public T get() {
try {
return init.get();
} catch (ConcurrentException e) {
throw new IllegalStateException(e);
}
}
};
}
开发者ID:opentable,项目名称:otj-data-structures,代码行数:24,代码来源:Java8Util.java
示例3: initialize
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
@Override
protected JAXBContext initialize() throws ConcurrentException {
try {
return JAXBContext.newInstance(Process.class);
} catch (JAXBException e) {
throw new ConcurrentException("Can not create JAXBContext for Business Process XML.", e);
}
}
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:9,代码来源:DefaultBpJaxbService.java
示例4: getTarget
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
private Mapper<?> getTarget() {
if (singleton)
try {
return singletonTarget.get();
} catch (ConcurrentException e) {
throw Exceptions.propagate(e);
}
else
return targetInitializer.get();
}
开发者ID:NewTranx,项目名称:newtranx-utils,代码行数:11,代码来源:MapperScannerConfigurer.java
示例5: Sum
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
public Sum(int a, int b) {
this.a = a;
this.b = b;
mSum = new LazyInitializer<Integer>() {
@Override
protected Integer initialize() throws ConcurrentException {
return Sum.this.a + Sum.this.b;
}
};
}
开发者ID:RoRoche,项目名称:AndroidTestingBox,代码行数:11,代码来源:Sum.java
示例6: plugin
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
/**
* Gets the plugin.
*
* @return The plugin.
*/
public static SpoofaxIdeaPlugin plugin() {
try {
return pluginLazy.get();
} catch (final ConcurrentException e) {
throw new UnhandledException("An unexpected unhandled exception occurred during object creation.", e);
}
}
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:13,代码来源:SpoofaxIdeaPlugin.java
示例7: getInstance
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
public static BasicMetaDataImpl getInstance() {
try {
return initializer.get();
} catch (ConcurrentException e) {
throw new NetSuiteException("Initialization error", e);
}
}
开发者ID:Talend,项目名称:components,代码行数:8,代码来源:BasicMetaDataImpl.java
示例8: getLogMapManager
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
/**
* Gets the LogMapManager for given {@link SharedLogObjectID}.
* <p/>
* If listener was not registered, it will create and register a listener.
*
* @param oid {@link SharedLogObjectID}
* @return {@link LogMapManager}
*/
private LogMapManager getLogMapManager(final SharedLogObjectID oid) {
LogMapManager listener
= ConcurrentUtils.createIfAbsentUnchecked(listenerMap, oid,
new ConcurrentInitializer<LogMapManager>() {
@Override
public LogMapManager get() throws ConcurrentException {
IMap<SeqNum, LogValue> logMap = getLogMap(oid);
return new LogMapManager(oid, logMap);
}
});
return listener;
}
开发者ID:opennetworkinglab,项目名称:spring-open,代码行数:21,代码来源:HazelcastRuntime.java
示例9: initialize
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
@Override
protected T initialize() throws ConcurrentException {
return initializer.get();
}
开发者ID:NewTranx,项目名称:newtranx-utils,代码行数:5,代码来源:Lazy.java
示例10: getSum
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
public int getSum() throws ConcurrentException {
return mSum.get();
}
开发者ID:RoRoche,项目名称:AndroidTestingBox,代码行数:4,代码来源:Sum.java
示例11: computingSum
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
@When("^computing sum$")
public void computingSum() throws ConcurrentException {
miSum = moSum.getSum();
}
开发者ID:RoRoche,项目名称:AndroidTestingBox,代码行数:5,代码来源:SumSteps.java
示例12: thenShouldBeEqualTo4
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
@Test
public void thenShouldBeEqualTo4() throws ConcurrentException {
assertThat(sum.getSum()).isEqualTo(4);
}
开发者ID:RoRoche,项目名称:AndroidTestingBox,代码行数:5,代码来源:HCRSumTest.java
示例13: thenShouldBeEqualTo3
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
@Test
public void thenShouldBeEqualTo3() throws ConcurrentException {
assertThat(multiply).isEqualTo(3);
}
开发者ID:RoRoche,项目名称:AndroidTestingBox,代码行数:5,代码来源:HCRSumTest.java
示例14: addition_isCorrect
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
@Test
public void addition_isCorrect() throws ConcurrentException {
given().first_number_$(1).and().second_number_$(3);
when().computing_sum();
then().it_should_be_$(4);
}
开发者ID:RoRoche,项目名称:AndroidTestingBox,代码行数:7,代码来源:JGivenSumTest.java
示例15: assertThat
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
public void it_should_be_$(final int piExpected) throws ConcurrentException {
assertThat(mSum.getSum()).isEqualTo(piExpected);
}
开发者ID:RoRoche,项目名称:AndroidTestingBox,代码行数:4,代码来源:JGivenSumTest.java
示例16: initialize
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
@Override
protected SpoofaxIdeaPlugin initialize() throws ConcurrentException {
return new SpoofaxIdeaPlugin();
}
开发者ID:metaborg,项目名称:spoofax-intellij,代码行数:5,代码来源:SpoofaxIdeaPlugin.java
示例17: initialize
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
@Override protected BasicMetaDataImpl initialize() throws ConcurrentException {
return new BasicMetaDataImpl();
}
开发者ID:Talend,项目名称:components,代码行数:4,代码来源:BasicMetaDataImpl.java
示例18: initialize
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
protected T initialize() throws ConcurrentException {
return func.call();
}
开发者ID:Shockah,项目名称:Skylark,代码行数:4,代码来源:Lazy.java
示例19: main
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
public static void main(String[] args) throws ConcurrentException {
LazyInitializerTest lazyInitializerTest = new LazyInitializerTest();
System.out.println(lazyInitializerTest.get());
System.out.println(lazyInitializerTest.get());
}
开发者ID:Qunzer,项目名称:learningJava,代码行数:8,代码来源:LazyInitializerExample.java
示例20: initialize
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
/**
* Creates and initializes the object managed by this {@code
* LazyInitializer}. This method is called by {@link #get()} when the object
* is accessed for the first time. An implementation can focus on the
* creation of the object. No synchronization is needed, as this is already
* handled by {@code get()}.
*
* @return the managed data object
* @throws ConcurrentException if an error occurs during object creation
*/
@Override
protected String initialize() throws ConcurrentException {
System.out.println("from the initialize method");
return "hello";
}
开发者ID:Qunzer,项目名称:learningJava,代码行数:16,代码来源:LazyInitializerExample.java
注:本文中的org.apache.commons.lang3.concurrent.ConcurrentException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论