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


Java AsyncResult.reject方法代码示例

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


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

示例1: doOpenProjectAsync

import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
public void doOpenProjectAsync(@Nonnull AsyncResult<Project> asyncResult,
                               @Nonnull VirtualFile virtualFile,
                               @Nullable Project projectToClose,
                               boolean forceOpenInNewFrame,
                               @Nonnull UIAccess uiAccess) {
  Project project = doOpenProject(virtualFile, projectToClose, forceOpenInNewFrame);
  if (project != null) {
    asyncResult.setDone(project);
  }
  else {
    asyncResult.reject("project not loaded");
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:14,代码来源:ProjectOpenProcessor.java

示例2: sleep

import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
public static boolean sleep(AsyncResult<?> promise, int time) {
  try {
    //noinspection BusyWait
    Thread.sleep(time);
  }
  catch (InterruptedException ignored) {
    if (promise != null) {
      promise.reject("Interrupted");
    }
    return true;
  }

  return false;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:NettyKt.java

示例3: connectNio

import com.intellij.openapi.util.AsyncResult; //导入方法依赖的package包/类
private static Channel connectNio(Bootstrap bootstrap,
                                  InetSocketAddress remoteAddress,
                                  AsyncResult<?> promise,
                                  int maxAttemptCount,
                                  @Nullable Condition<Void> stopCondition,
                                  int _attemptCount) {
  int attemptCount = _attemptCount;
  while (true) {
    ChannelFuture future = bootstrap.connect(remoteAddress).awaitUninterruptibly();
    if (future.isSuccess()) {
      if (!future.channel().isOpen()) {
        continue;
      }
      return future.channel();
    }
    else if (stopCondition != null && stopCondition.value(null) || promise != null && promise.isRejected()) {
      return null;
    }
    else if (maxAttemptCount == -1) {
      if (sleep(promise, 300)) {
        return null;
      }
      attemptCount++;
    }
    else if (++attemptCount < maxAttemptCount) {
      if (sleep(promise, attemptCount * NettyUtil.MIN_START_TIME)) {
        return null;
      }
    }
    else {
      Throwable cause = future.cause();
      if (promise != null) {
        if (cause == null) {
          promise.reject("Cannot connect: unknown error");
        }
        else {
          promise.rejectWithThrowable(cause);
        }
      }
      return null;
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:44,代码来源:NettyKt.java


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