當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。