Java 类org.apache.commons.lang3.concurrent.ConcurrentException 实例源码

项目:cassandra-reaper    文件:SegmentRunner.java   
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);
    }
  }
}
项目:otj-data-structures    文件:Java8Util.java   
/**
 * 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);
            }
        }
    };
}
项目:hybris-integration-intellij-idea-plugin    文件:DefaultBpJaxbService.java   
@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);
    }
}
项目:newtranx-utils    文件:MapperScannerConfigurer.java   
private Mapper<?> getTarget() {
    if (singleton)
        try {
            return singletonTarget.get();
        } catch (ConcurrentException e) {
            throw Exceptions.propagate(e);
        }
    else
        return targetInitializer.get();
}
项目:AndroidTestingBox    文件:Sum.java   
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;
        }
    };
}
项目:spoofax-intellij    文件:SpoofaxIdeaPlugin.java   
/**
 * 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);
    }
}
项目:components    文件:BasicMetaDataImpl.java   
public static BasicMetaDataImpl getInstance() {
    try {
        return initializer.get();
    } catch (ConcurrentException e) {
        throw new NetSuiteException("Initialization error", e);
    }
}
项目:components    文件:BasicMetaDataImpl.java   
public static BasicMetaDataImpl getInstance() {
    try {
        return initializer.get();
    } catch (ConcurrentException e) {
        throw new NetSuiteException("Initialization error", e);
    }
}
项目:spring-open    文件:HazelcastRuntime.java   
/**
 * 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;
}
项目:newtranx-utils    文件:Lazy.java   
@Override
protected T initialize() throws ConcurrentException {
    return initializer.get();
}
项目:AndroidTestingBox    文件:Sum.java   
public int getSum() throws ConcurrentException {
    return mSum.get();
}
项目:AndroidTestingBox    文件:SumSteps.java   
@When("^computing sum$")
public void computingSum() throws ConcurrentException {
    miSum = moSum.getSum();
}
项目:AndroidTestingBox    文件:HCRSumTest.java   
@Test
public void thenShouldBeEqualTo4() throws ConcurrentException {
    assertThat(sum.getSum()).isEqualTo(4);
}
项目:AndroidTestingBox    文件:HCRSumTest.java   
@Test
public void thenShouldBeEqualTo3() throws ConcurrentException {
    assertThat(multiply).isEqualTo(3);
}
项目:AndroidTestingBox    文件:JGivenSumTest.java   
@Test
public void addition_isCorrect() throws ConcurrentException {
    given().first_number_$(1).and().second_number_$(3);
    when().computing_sum();
    then().it_should_be_$(4);
}
项目:AndroidTestingBox    文件:JGivenSumTest.java   
public void it_should_be_$(final int piExpected) throws ConcurrentException {
    assertThat(mSum.getSum()).isEqualTo(piExpected);
}
项目:spoofax-intellij    文件:SpoofaxIdeaPlugin.java   
@Override
protected SpoofaxIdeaPlugin initialize() throws ConcurrentException {
    return new SpoofaxIdeaPlugin();
}
项目:components    文件:BasicMetaDataImpl.java   
@Override protected BasicMetaDataImpl initialize() throws ConcurrentException {
    return new BasicMetaDataImpl();
}
项目:components    文件:BasicMetaDataImpl.java   
@Override protected BasicMetaDataImpl initialize() throws ConcurrentException {
    return new BasicMetaDataImpl();
}
项目:Skylark    文件:Lazy.java   
protected T initialize() throws ConcurrentException {
    return func.call();
}
项目:learningJava    文件:LazyInitializerExample.java   
public static void main(String[] args) throws ConcurrentException {
    LazyInitializerTest lazyInitializerTest = new LazyInitializerTest();

    System.out.println(lazyInitializerTest.get());
    System.out.println(lazyInitializerTest.get());

}
项目:learningJava    文件:LazyInitializerExample.java   
/**
 * 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";
}