• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PooledThreadExecutor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.jetbrains.ide.PooledThreadExecutor的典型用法代码示例。如果您正苦于以下问题:Java PooledThreadExecutor类的具体用法?Java PooledThreadExecutor怎么用?Java PooledThreadExecutor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



PooledThreadExecutor类属于org.jetbrains.ide包,在下文中一共展示了PooledThreadExecutor类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: startListening

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
private int startListening() throws Exception {
  final ServerBootstrap bootstrap = NettyUtil.nioServerBootstrap(new NioEventLoopGroup(1, PooledThreadExecutor.INSTANCE));
  bootstrap.childHandler(new ChannelInitializer() {
    @Override
    protected void initChannel(Channel channel) throws Exception {
      channel.pipeline().addLast(myChannelRegistrar,
                                 new ProtobufVarint32FrameDecoder(),
                                 new ProtobufDecoder(CmdlineRemoteProto.Message.getDefaultInstance()),
                                 new ProtobufVarint32LengthFieldPrepender(),
                                 new ProtobufEncoder(),
                                 myMessageDispatcher);
    }
  });
  Channel serverChannel = bootstrap.bind(NetUtils.getLoopbackAddress(), 0).syncUninterruptibly().channel();
  myChannelRegistrar.add(serverChannel);
  return ((InetSocketAddress)serverChannel.localAddress()).getPort();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:BuildManager.java


示例2: ConcurrencyService

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
public ConcurrencyService(ProfileStore profileStore, ProfileService profileService,
                          SolutionService solutionService,
                          HelpRequestStore helpRequestStore, HelpRequestService helpRequestService,
                          SearchService searchService) {
    this.profileStore = profileStore;
    this.profileService = profileService;
    this.solutionService = solutionService;
    this.helpRequestStore = helpRequestStore;
    this.helpRequestService = helpRequestService;
    this.searchService = searchService;
    executor = PooledThreadExecutor.INSTANCE;
}
 
开发者ID:samebug,项目名称:samebug-idea-plugin,代码行数:13,代码来源:ConcurrencyService.java


示例3: getProjectData

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
@NotNull
private ProjectData getProjectData(String projectPath) {
  synchronized (myProjectDataMap) {
    ProjectData data = myProjectDataMap.get(projectPath);
    if (data == null) {
      data = new ProjectData(new SequentialTaskExecutor(PooledThreadExecutor.INSTANCE));
      myProjectDataMap.put(projectPath, data);
    }
    return data;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:BuildManager.java


示例4: start

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
@NotNull
public static BuiltInServer start(int workerCount,
                                  int firstPort,
                                  int portsCount,
                                  boolean tryAnyPort,
                                  @Nullable NotNullProducer<ChannelHandler> handler) throws Exception {
  return start(new NioEventLoopGroup(workerCount, PooledThreadExecutor.INSTANCE), true, firstPort, portsCount, tryAnyPort, handler);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:BuiltInServer.java


示例5: TransferToPooledThreadQueue

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
public TransferToPooledThreadQueue(@NonNls @NotNull String name,
                                   @NotNull Condition<?> shutUpCondition,
                                   int maxUnitOfWorkThresholdMs,
                                   @NotNull Processor<T> processor) {
  super(name, processor, shutUpCondition, maxUnitOfWorkThresholdMs);
  myExecutor = new BoundedTaskExecutor(PooledThreadExecutor.INSTANCE, 1);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:TransferToPooledThreadQueue.java


示例6: prepareScriptEnginesAsync

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
@NotNull
private static Future<List<Pair<VirtualFile, IdeScriptEngine>>> prepareScriptEnginesAsync(@NotNull final List<VirtualFile> scripts) {
  return PooledThreadExecutor.INSTANCE.submit(new Callable<List<Pair<VirtualFile, IdeScriptEngine>>>() {
    @Override
    public List<Pair<VirtualFile, IdeScriptEngine>> call() throws Exception {
      return prepareScriptEngines(scripts);
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:IdeStartupScripts.java


示例7: submit

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
@NotNull
public synchronized Future<Boolean> submit(@NotNull final Executor executor) {
  if(currentExecutor != null) {
    currentExecutor.cancel();
  }

  currentExecutor = executor;

  PooledThreadExecutor.INSTANCE.execute(executor);

  return currentExecutor.promise.future();
}
 
开发者ID:defrac,项目名称:defrac-plugin-intellij,代码行数:13,代码来源:DefracIpc.java


示例8: checkProjectRoots

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
private void checkProjectRoots() {
  VirtualFile[] roots = ProjectRootManager.getInstance(myProject).getContentRoots();
  if (roots.length == 0) return;
  LocalFileSystem fs = LocalFileSystem.getInstance();
  if (!(fs instanceof LocalFileSystemImpl)) return;
  FileWatcher watcher = ((LocalFileSystemImpl)fs).getFileWatcher();
  if (!watcher.isOperational()) return;

  PooledThreadExecutor.INSTANCE.submit(() -> {
    LOG.debug("FW/roots waiting started");
    while (true) {
      if (myProject.isDisposed()) return;
      if (!watcher.isSettingRoots()) break;
      TimeoutUtil.sleep(10);
    }
    LOG.debug("FW/roots waiting finished");

    Collection<String> manualWatchRoots = watcher.getManualWatchRoots();
    if (!manualWatchRoots.isEmpty()) {
      List<String> nonWatched = new SmartList<>();
      for (VirtualFile root : roots) {
        if (!(root.getFileSystem() instanceof LocalFileSystem)) continue;
        String rootPath = root.getPath();
        for (String manualWatchRoot : manualWatchRoots) {
          if (FileUtil.isAncestor(manualWatchRoot, rootPath, false)) {
            nonWatched.add(rootPath);
          }
        }
      }
      if (!nonWatched.isEmpty()) {
        String message = ApplicationBundle.message("watcher.non.watchable.project");
        watcher.notifyOnFailure(message, null);
        LOG.info("unwatched roots: " + nonWatched);
        LOG.info("manual watches: " + manualWatchRoots);
      }
    }
  });
}
 
开发者ID:consulo,项目名称:consulo,代码行数:39,代码来源:StartupManagerImpl.java


示例9: runWithCheckCanceled

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
/**
 * Allows to interrupt a process which does not performs checkCancelled() calls by itself.
 * Note that the process may continue to run in background indefinitely - so <b>avoid using this method unless absolutely needed</b>.
 */
public static <T> T runWithCheckCanceled(@Nonnull final Callable<T> callable, @Nonnull final ProgressIndicator indicator) throws Exception {
  final Ref<T> result = Ref.create();
  final Ref<Throwable> error = Ref.create();

  Future<?> future = PooledThreadExecutor.INSTANCE.submit(() -> ProgressManager.getInstance().executeProcessUnderProgress(() -> {
    try {
      result.set(callable.call());
    }
    catch (Throwable t) {
      error.set(t);
    }
  }, indicator));

  while (true) {
    try {
      indicator.checkCanceled();
    }
    catch (ProcessCanceledException e) {
      future.cancel(true);
      throw e;
    }

    try {
      future.get(200, TimeUnit.MILLISECONDS);
      ExceptionUtil.rethrowAll(error.get());
      return result.get();
    }
    catch (TimeoutException ignored) {
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:36,代码来源:ApplicationUtil.java


示例10: WebSocketClientService

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
public WebSocketClientService(NotificationController notificationController) {
    this.notificationController = notificationController;
    this.client = new AtomicReference<WebSocketClient>(null);
    this.group = new NioEventLoopGroup(1, PooledThreadExecutor.INSTANCE);
}
 
开发者ID:samebug,项目名称:samebug-idea-plugin,代码行数:6,代码来源:WebSocketClientService.java


示例11: ServerTaskExecutorImpl

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
public ServerTaskExecutorImpl() {
  myTaskExecutor = new SequentialTaskExecutor(PooledThreadExecutor.INSTANCE);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ServerTaskExecutorImpl.java


示例12: oioClientBootstrap

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
@NotNull
public static Bootstrap oioClientBootstrap() {
  Bootstrap bootstrap = new Bootstrap().group(new OioEventLoopGroup(1, PooledThreadExecutor.INSTANCE)).channel(OioSocketChannel.class);
  bootstrap.option(ChannelOption.TCP_NODELAY, true).option(ChannelOption.SO_KEEPALIVE, true);
  return bootstrap;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:7,代码来源:NettyUtil.java


示例13: nioClientBootstrap

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
@SuppressWarnings("UnusedDeclaration")
public static Bootstrap nioClientBootstrap() {
  return nioClientBootstrap(new NioEventLoopGroup(1, PooledThreadExecutor.INSTANCE));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:NettyUtil.java


示例14: scheduleWithWriteActionPriority

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
public static void scheduleWithWriteActionPriority(@NotNull ProgressIndicator progressIndicator, @NotNull ReadTask readTask) {
  scheduleWithWriteActionPriority(progressIndicator, PooledThreadExecutor.INSTANCE, readTask);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:4,代码来源:ProgressIndicatorUtils.java


示例15: executeOnPooledThread

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
@NotNull
@Override
public Future<?> executeOnPooledThread(@NotNull Runnable action) {
  return PooledThreadExecutor.INSTANCE.submit(action);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:6,代码来源:MockApplication.java


示例16: runWithCheckCanceled

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
/**
 * Allows to interrupt a process which does not performs checkCancelled() calls by itself.
 * Note that the process may continue to run in background indefinitely - so <b>avoid using this method unless absolutely needed</b>.
 */
public static <T> T runWithCheckCanceled(@NotNull final Callable<T> callable,
                                         @NotNull final ProgressIndicator indicator) throws Exception {
  return runWithCheckCanceled(callable, indicator, PooledThreadExecutor.INSTANCE);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ApplicationUtil.java


示例17: doCompile

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
@Override
protected boolean doCompile(@NotNull final CompileContext context,
                            @NotNull final DefracRunConfiguration configuration,
                            @NotNull final DefracFacet facet) {
  final DefracIpc ipc =
      DefracProcess.getInstance(context.getProject()).getIpc();

  if(ipc == null) {
    reportError(context, "Couldn't find defrac facet");
    return false;
  }

  final DefracIpc.Executor executor = doCompile(context, configuration, facet, ipc);

  if(executor == null) {
    // noop
    return true;
  }

  executor.addListener(new DefracIpc.ExecutorAdapter() {
    @Override
    public void onMessage(@NotNull final DefracCommandLineParser.Message message) {
      context.addMessage(message.category, message.text, null, -1, -1);
    }

    @Override
    public void onError(@NotNull final Exception exception) {
      context.addMessage(CompilerMessageCategory.ERROR, exception.getMessage(), null, -1, -1);
    }

    @Override
    public void onComplete(final int exitCode) {
      executor.cancel();
    }
  });

  final Future<Boolean> future = ipc.submit(executor);

  for(; ; ) {
    if(context.getProgressIndicator().isCanceled()) {
      if(executor.listening()) {
        executor.cancel();
      }
      return false;
    }

    try {
      final Attempt<Boolean> attempt =
          Futures.await(future, PooledThreadExecutor.INSTANCE, 100, TimeUnit.MILLISECONDS);

      if(attempt != null) {
        return attempt.isSuccess() ? attempt.get() : false;
      }
    } catch(final InterruptedException interrupt) {
      Thread.currentThread().interrupt();
      return false;
    }
  }
}
 
开发者ID:defrac,项目名称:defrac-plugin-intellij,代码行数:60,代码来源:BooleanBasedCompilerTask.java


示例18: BuiltInServer

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
public BuiltInServer(int workerCount) {
  Executor pooledThreadExecutor = new PooledThreadExecutor();
  channelFactory = new NioServerSocketChannelFactory(pooledThreadExecutor, pooledThreadExecutor, workerCount);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:5,代码来源:BuiltInServer.java


示例19: nioClientBootstrap

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
public static Bootstrap nioClientBootstrap() {
  return nioClientBootstrap(new NioEventLoopGroup(1, PooledThreadExecutor.INSTANCE));
}
 
开发者ID:consulo,项目名称:consulo,代码行数:4,代码来源:NettyUtil.java


示例20: scheduleWithWriteActionPriority

import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
@Nonnull
public static CompletableFuture<?> scheduleWithWriteActionPriority(@Nonnull ProgressIndicator progressIndicator, @Nonnull ReadTask readTask) {
  return scheduleWithWriteActionPriority(progressIndicator, PooledThreadExecutor.INSTANCE, readTask);
}
 
开发者ID:consulo,项目名称:consulo,代码行数:5,代码来源:ProgressIndicatorUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PhysicsWorld类代码示例发布时间:2022-05-22
下一篇:
Java AttributeList类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap