本文整理了Java中com.google.common.util.concurrent.Service.stopAndWait()
方法的一些代码示例,展示了Service.stopAndWait()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Service.stopAndWait()
方法的具体详情如下:
包路径:com.google.common.util.concurrent.Service
类名称:Service
方法名:stopAndWait
[英]Initiates service shutdown (if necessary), returning once the service has finished stopping. If this is State#STARTING, startup will be cancelled. If this is State#NEW, it is State#TERMINATED without having been started nor stopped. Unlike calling stop().get(), this method throws no checked exceptions.
[中]启动服务关闭(如有必要),服务停止后返回。如果这是状态#启动,启动将被取消。如果这是状态#新,则它是状态#终止,没有启动或停止。与调用stop()不同。get(),此方法不会抛出已检查的异常。
代码示例来源:origin: org.apache.twill/twill-yarn
@Override
public void run() {
mainService.stopAndWait();
}
});
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Deprecated
@Override
public final State stopAndWait() {
return delegate.stopAndWait();
}
代码示例来源:origin: co.cask.cdap/cdap-app-fabric
private void stopQuietly(Service service) {
try {
service.stopAndWait();
} catch (Exception e) {
LOG.debug("Error stopping the preview runner.", e);
}
}
代码示例来源:origin: co.cask.cdap/cdap-app-fabric
/**
* Stops the given service and wait for the completion. If there is exception, just log.
*/
private void stopService(Service service) {
try {
service.stopAndWait();
} catch (Throwable t) {
LOG.warn("Exception when stopping service {}", service);
}
}
}
代码示例来源:origin: co.cask.cdap/cdap-kafka-flow-core
/**
* Stops a {@link Service} and waits for the completion. If there is exception during stop, it will get logged.
*/
protected final void stopService(Service service) {
try {
service.stopAndWait();
} catch (Throwable t) {
LOG.error("Failed when stopping service {}", service, t);
}
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/com.google.guava
@Deprecated
@Override
public final State stopAndWait() {
return delegate.stopAndWait();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby
@Deprecated
@Override
public final State stopAndWait() {
return delegate.stopAndWait();
}
代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-analytics
@Deprecated
@Override
public final State stopAndWait() {
return delegate.stopAndWait();
}
代码示例来源:origin: cdapio/cdap
private void stopCoreServices() {
// Stop all services. Reverse the order.
for (Service service : (Iterable<Service>) coreServices::descendingIterator) {
try {
service.stopAndWait();
} catch (Exception e) {
LOG.warn("Exception raised when stopping service {} during program termination.", service, e);
}
}
logAppenderInitializer.close();
}
代码示例来源:origin: co.cask.cdap/cdap-app-fabric
private void stopCoreServices() {
// Stop all services. Reverse the order.
for (Service service : (Iterable<Service>) coreServices::descendingIterator) {
try {
service.stopAndWait();
} catch (Exception e) {
LOG.warn("Exception raised when stopping service {} during program termination.", service, e);
}
}
logAppenderInitializer.close();
}
代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby
@Deprecated
@Override
public State stopAndWait() {
return delegate().stopAndWait();
}
代码示例来源:origin: cdapio/cdap
@Override
protected void doStop() throws Exception {
if (service.state() != Service.State.TERMINATED && service.state() != Service.State.FAILED) {
LOG.debug("stopping controller service for program {}.", getProgramRunId());
service.stopAndWait();
LOG.debug("stopped controller service for program {}, waiting for it to finish running listener hooks.",
getProgramRunId());
serviceStoppedLatch.await(30, TimeUnit.SECONDS);
LOG.debug("controller service for program {} finished running listener hooks.", getProgramRunId());
}
}
代码示例来源:origin: co.cask.cdap/cdap-app-fabric
@Override
protected void doStop() throws Exception {
if (service.state() != Service.State.TERMINATED && service.state() != Service.State.FAILED) {
LOG.debug("stopping controller service for program {}.", getProgramRunId());
service.stopAndWait();
LOG.debug("stopped controller service for program {}, waiting for it to finish running listener hooks.",
getProgramRunId());
serviceStoppedLatch.await(30, TimeUnit.SECONDS);
LOG.debug("controller service for program {} finished running listener hooks.", getProgramRunId());
}
}
代码示例来源:origin: cdapio/cdap
@Override
protected void shutDown() throws Exception {
shutDownUnrequiredServices();
datasetService.stopAndWait();
if (messagingService instanceof Service) {
((Service) messagingService).stopAndWait();
}
levelDBTableService.close();
}
代码示例来源:origin: co.cask.cdap/cdap-app-fabric
@Override
protected void shutDown() throws Exception {
shutDownUnrequiredServices();
datasetService.stopAndWait();
if (messagingService instanceof Service) {
((Service) messagingService).stopAndWait();
}
levelDBTableService.close();
}
代码示例来源:origin: cdapio/cdap
@AfterClass
public static void afterClass() throws Exception {
AppFabricTestBase.afterClass();
if (scheduler instanceof Service) {
((Service) scheduler).stopAndWait();
}
}
代码示例来源:origin: cdapio/cdap
@Test
public void testStopWhileRetrying() throws InterruptedException {
// This test the service can be stopped during failure retry
CountDownLatch failureLatch = new CountDownLatch(1);
Service service = new RetryOnStartFailureService(
createServiceSupplier(1000, new CountDownLatch(1), failureLatch, false),
RetryStrategies.fixDelay(10, TimeUnit.MILLISECONDS));
service.startAndWait();
Assert.assertTrue(failureLatch.await(1, TimeUnit.SECONDS));
service.stopAndWait();
}
代码示例来源:origin: cdapio/cdap
@AfterClass
public static void finish() {
if (messagingService instanceof Service) {
((Service) messagingService).stopAndWait();
}
datasetService.stopAndWait();
txManager.stopAndWait();
}
代码示例来源:origin: cdapio/cdap
@AfterClass
public static void cleanupClass() {
provisioningService.stopAndWait();
datasetService.stopAndWait();
txManager.stopAndWait();
if (messagingService instanceof Service) {
((Service) messagingService).stopAndWait();
}
}
代码示例来源:origin: cdapio/cdap
@After
public void stop() {
runtimeServer.stopAndWait();
datasetService.stopAndWait();
txManager.stopAndWait();
if (messagingService instanceof Service) {
((Service) messagingService).stopAndWait();
}
}
内容来源于网络,如有侵权,请联系作者删除!