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


Java Future.isCompleted方法代码示例

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


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

示例1: destroy

import scala.concurrent.Future; //导入方法依赖的package包/类
@Override
public void destroy(Object obj) {
    logger.debug("akkasystem close");
    Future<Terminated> terminate = system.terminate();
    while (terminate.isCompleted()) {
        logger.debug("akkasystem closed");
    }

}
 
开发者ID:zerosoft,项目名称:CodeBroker,代码行数:10,代码来源:AkkaBootService.java

示例2: abort

import scala.concurrent.Future; //导入方法依赖的package包/类
@Override
public void abort(final FutureCallback<Void> abortCallback) {
    if (!dataTree.startAbort(this)) {
        abortCallback.onSuccess(null);
        return;
    }

    candidate = null;
    state = State.ABORTED;

    final Optional<List<Future<Object>>> maybeAborts = userCohorts.abort();
    if (!maybeAborts.isPresent()) {
        abortCallback.onSuccess(null);
        return;
    }

    final Future<Iterable<Object>> aborts = Futures.sequence(maybeAborts.get(), ExecutionContexts.global());
    if (aborts.isCompleted()) {
        abortCallback.onSuccess(null);
        return;
    }

    aborts.onComplete(new OnComplete<Iterable<Object>>() {
        @Override
        public void onComplete(final Throwable failure, final Iterable<Object> objs) {
            if (failure != null) {
                abortCallback.onFailure(failure);
            } else {
                abortCallback.onSuccess(null);
            }
        }
    }, ExecutionContexts.global());
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:34,代码来源:SimpleShardDataTreeCohort.java

示例3: newTransactionContextWrapper

import scala.concurrent.Future; //导入方法依赖的package包/类
final TransactionContextWrapper newTransactionContextWrapper(final TransactionProxy parent,
        final String shardName) {
    final TransactionContextWrapper transactionContextWrapper =
            new TransactionContextWrapper(parent.getIdentifier(), actorContext);

    Future<PrimaryShardInfo> findPrimaryFuture = findPrimaryShard(shardName, parent.getIdentifier());
    if (findPrimaryFuture.isCompleted()) {
        Try<PrimaryShardInfo> maybe = findPrimaryFuture.value().get();
        if (maybe.isSuccess()) {
            onFindPrimaryShardSuccess(maybe.get(), parent, shardName, transactionContextWrapper);
        } else {
            onFindPrimaryShardFailure(maybe.failed().get(), parent, shardName, transactionContextWrapper);
        }
    } else {
        findPrimaryFuture.onComplete(new OnComplete<PrimaryShardInfo>() {
            @Override
            public void onComplete(final Throwable failure, final PrimaryShardInfo primaryShardInfo) {
                if (failure == null) {
                    onFindPrimaryShardSuccess(primaryShardInfo, parent, shardName, transactionContextWrapper);
                } else {
                    onFindPrimaryShardFailure(failure, parent, shardName, transactionContextWrapper);
                }
            }
        }, actorContext.getClientDispatcher());
    }

    return transactionContextWrapper;
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:29,代码来源:AbstractTransactionContextFactory.java


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