本文整理汇总了Java中org.jetbrains.ide.PooledThreadExecutor类的典型用法代码示例。如果您正苦于以下问题:Java PooledThreadExecutor类的具体用法?Java PooledThreadExecutor怎么用?Java PooledThreadExecutor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PooledThreadExecutor类属于org.jetbrains.ide包,在下文中一共展示了PooledThreadExecutor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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;
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
});
}
示例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();
}
示例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);
}
}
});
}
示例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) {
}
}
}
示例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);
}
示例11: ServerTaskExecutorImpl
import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
public ServerTaskExecutorImpl() {
myTaskExecutor = new SequentialTaskExecutor(PooledThreadExecutor.INSTANCE);
}
示例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;
}
示例13: nioClientBootstrap
import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
@SuppressWarnings("UnusedDeclaration")
public static Bootstrap nioClientBootstrap() {
return nioClientBootstrap(new NioEventLoopGroup(1, PooledThreadExecutor.INSTANCE));
}
示例14: scheduleWithWriteActionPriority
import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
public static void scheduleWithWriteActionPriority(@NotNull ProgressIndicator progressIndicator, @NotNull ReadTask readTask) {
scheduleWithWriteActionPriority(progressIndicator, PooledThreadExecutor.INSTANCE, readTask);
}
示例15: executeOnPooledThread
import org.jetbrains.ide.PooledThreadExecutor; //导入依赖的package包/类
@NotNull
@Override
public Future<?> executeOnPooledThread(@NotNull Runnable action) {
return PooledThreadExecutor.INSTANCE.submit(action);
}