当前位置: 首页>>代码示例>>Java>>正文


Java MoreExecutors.shutdownAndAwaitTermination方法代码示例

本文整理汇总了Java中com.google.common.util.concurrent.MoreExecutors.shutdownAndAwaitTermination方法的典型用法代码示例。如果您正苦于以下问题:Java MoreExecutors.shutdownAndAwaitTermination方法的具体用法?Java MoreExecutors.shutdownAndAwaitTermination怎么用?Java MoreExecutors.shutdownAndAwaitTermination使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.common.util.concurrent.MoreExecutors的用法示例。


在下文中一共展示了MoreExecutors.shutdownAndAwaitTermination方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: close

import com.google.common.util.concurrent.MoreExecutors; //导入方法依赖的package包/类
/** Stops receiving messages from the inspector and closes it. */
@Override
public void close() throws IOException {
  try {
    // Canceling the future marks the future done and the messenger "closed".
    // If it can't be cancelled, it must have terminated prematurely, so raise an exception.
    if (!receiveFuture.cancel(false)) {
      Futures.getChecked(receiveFuture, IOException.class);
    }
  } finally {
    try {
      MoreExecutors.shutdownAndAwaitTermination(executor, 5, SECONDS);
    } finally {
      inspector.close();
    }
  }
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:18,代码来源:InspectorMessenger.java

示例2: close

import com.google.common.util.concurrent.MoreExecutors; //导入方法依赖的package包/类
@Override
public void close() {
  if (!MoreExecutors.shutdownAndAwaitTermination(executor, 5, SECONDS)) {
    log.severe("Executor did not terminate successfully");
  }
  if (browser != null) {
    try {
      browser.close();
    } catch (BrowserException e) {
      throw new WebDriverException(e);
    }
  }
}
 
开发者ID:google,项目名称:devtools-driver,代码行数:14,代码来源:RemoteIOSWebDriver.java

示例3: shutdownExecutorService

import com.google.common.util.concurrent.MoreExecutors; //导入方法依赖的package包/类
public static void shutdownExecutorService(Engine engine, Object named, ExecutorService executorService) {
    MoreExecutors.shutdownAndAwaitTermination(executorService, engine.getDefaultParameters().getExecutorShutdownTimeout(),
            TimeUnit.SECONDS);
    if (!executorService.isTerminated()) {
        logger.warn("Executor for {} hasn't shutdown gracefully.", named);
    }
}
 
开发者ID:softelnet,项目名称:sponge,代码行数:8,代码来源:SpongeUtils.java

示例4: gracefulShutdown

import com.google.common.util.concurrent.MoreExecutors; //导入方法依赖的package包/类
/**
 * @see gracefulShutdown
 */
public static boolean gracefulShutdown(@Nullable ExecutorService threadPool, int shutdownTimeout,
		TimeUnit timeUnit) {
	return threadPool != null ? MoreExecutors.shutdownAndAwaitTermination(threadPool, shutdownTimeout, timeUnit)
			: true;
}
 
开发者ID:zhangjunfang,项目名称:util,代码行数:9,代码来源:ThreadPoolUtil.java


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