本文整理汇总了Java中org.apache.commons.lang3.concurrent.ConcurrentException类的典型用法代码示例。如果您正苦于以下问题:Java ConcurrentException类的具体用法?Java ConcurrentException怎么用?Java ConcurrentException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConcurrentException类属于org.apache.commons.lang3.concurrent包,在下文中一共展示了ConcurrentException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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);
}
}
};
}
示例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();
}
示例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;
}
};
}
示例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);
}
}
示例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);
}
}
示例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;
}
示例9: initialize
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
@Override
protected T initialize() throws ConcurrentException {
return initializer.get();
}
示例10: getSum
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
public int getSum() throws ConcurrentException {
return mSum.get();
}
示例11: computingSum
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
@When("^computing sum$")
public void computingSum() throws ConcurrentException {
miSum = moSum.getSum();
}
示例12: thenShouldBeEqualTo4
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
@Test
public void thenShouldBeEqualTo4() throws ConcurrentException {
assertThat(sum.getSum()).isEqualTo(4);
}
示例13: thenShouldBeEqualTo3
import org.apache.commons.lang3.concurrent.ConcurrentException; //导入依赖的package包/类
@Test
public void thenShouldBeEqualTo3() throws ConcurrentException {
assertThat(multiply).isEqualTo(3);
}
示例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);
}
示例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);
}