本文整理汇总了Java中com.intellij.util.concurrency.QueueProcessor类的典型用法代码示例。如果您正苦于以下问题:Java QueueProcessor类的具体用法?Java QueueProcessor怎么用?Java QueueProcessor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
QueueProcessor类属于com.intellij.util.concurrency包,在下文中一共展示了QueueProcessor类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: BackgroundTaskQueue
import com.intellij.util.concurrency.QueueProcessor; //导入依赖的package包/类
public BackgroundTaskQueue(@Nullable final Project project, @NotNull String title, final Boolean forcedHeadlessMode) {
myMonitor = Boolean.TRUE.equals(Boolean.getBoolean(ourMonitorFlag)) ? new BackgroundTasksMonitor(title) : new PlusMinus.Empty<String>();
final boolean headless = forcedHeadlessMode != null ? forcedHeadlessMode : ApplicationManager.getApplication().isHeadlessEnvironment();
final QueueProcessor.ThreadToUse threadToUse = headless ? QueueProcessor.ThreadToUse.POOLED : QueueProcessor.ThreadToUse.AWT;
final PairConsumer<Pair<Task.Backgroundable, Getter<ProgressIndicator>>, Runnable> consumer
= headless ? new BackgroundableHeadlessRunner() : new BackgroundableUnderProgressRunner(title, project, myMonitor);
myProcessor = new QueueProcessor<Pair<Task.Backgroundable, Getter<ProgressIndicator>>>(consumer, true,
threadToUse, new Condition<Object>() {
@Override public boolean value(Object o) {
if (project == null) return ApplicationManager.getApplication().isDisposed();
if (project.isDefault()) {
return project.isDisposed();
} else {
return !ApplicationManager.getApplication().isUnitTestMode() && !project.isOpen() || project.isDisposed();
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:BackgroundTaskQueue.java
示例2: GitRepositoryUpdater
import com.intellij.util.concurrency.QueueProcessor; //导入依赖的package包/类
GitRepositoryUpdater(@NotNull GitRepository repository) {
myRepository = repository;
VirtualFile gitDir = repository.getGitDir();
myWatchRequest = LocalFileSystem.getInstance().addRootToWatch(gitDir.getPath(), true);
myRepositoryFiles = GitRepositoryFiles.getInstance(gitDir);
DvcsUtil.visitVcsDirVfs(gitDir, GitRepositoryFiles.getSubDirRelativePaths());
myHeadsDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsHeadsPath());
myRemotesDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsRemotesPath());
myTagsDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsTagsPath());
Project project = repository.getProject();
myUpdateQueue = new QueueProcessor<Object>(new DvcsUtil.Updater(repository), project.getDisposed());
if (!project.isDisposed()) {
myMessageBusConnection = project.getMessageBus().connect();
myMessageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, this);
}
else {
myMessageBusConnection = null;
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GitRepositoryUpdater.java
示例3: HgRepositoryUpdater
import com.intellij.util.concurrency.QueueProcessor; //导入依赖的package包/类
HgRepositoryUpdater(@NotNull final HgRepository repository) {
VirtualFile hgDir = repository.getHgDir();
myWatchRequest = LocalFileSystem.getInstance().addRootToWatch(hgDir.getPath(), true);
myRepositoryFiles = HgRepositoryFiles.getInstance(hgDir);
DvcsUtil.visitVcsDirVfs(hgDir, HgRepositoryFiles.getSubDirRelativePaths());
myBranchHeadsDir = VcsUtil.getVirtualFile(myRepositoryFiles.getBranchHeadsDirPath());
myMqDir = VcsUtil.getVirtualFile(myRepositoryFiles.getMQDirPath());
Project project = repository.getProject();
myUpdateQueue = new QueueProcessor<Object>(new DvcsUtil.Updater(repository), project.getDisposed());
myUpdateConfigQueue = new QueueProcessor<Object>(new Consumer<Object>() {
@Override
public void consume(Object dummy) {
repository.updateConfig();
}
}, project.getDisposed());
if (!project.isDisposed()) {
myMessageBusConnection = project.getMessageBus().connect();
myMessageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, this);
}
else {
myMessageBusConnection = null;
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:HgRepositoryUpdater.java
示例4: GitRepositoryUpdater
import com.intellij.util.concurrency.QueueProcessor; //导入依赖的package包/类
GitRepositoryUpdater(@NotNull GitRepository repository) {
VirtualFile gitDir = repository.getGitDir();
myWatchRequest = LocalFileSystem.getInstance().addRootToWatch(gitDir.getPath(), true);
myRepositoryFiles = GitRepositoryFiles.getInstance(gitDir);
RepositoryUtil.visitVcsDirVfs(gitDir, GitRepositoryFiles.getSubDirRelativePaths());
myHeadsDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsHeadsPath());
myRemotesDir = VcsUtil.getVirtualFile(myRepositoryFiles.getRefsRemotesPath());
Project project = repository.getProject();
myUpdateQueue = new QueueProcessor<Object>(new RepositoryUtil.Updater(repository), project.getDisposed());
if (!project.isDisposed()) {
myMessageBusConnection = project.getMessageBus().connect();
myMessageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, this);
}
else {
myMessageBusConnection = null;
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:GitRepositoryUpdater.java
示例5: HgRepositoryUpdater
import com.intellij.util.concurrency.QueueProcessor; //导入依赖的package包/类
HgRepositoryUpdater(@NotNull final HgRepository repository) {
VirtualFile hgDir = repository.getHgDir();
myWatchRequest = LocalFileSystem.getInstance().addRootToWatch(hgDir.getPath(), true);
myRepositoryFiles = HgRepositoryFiles.getInstance(hgDir);
RepositoryUtil.visitVcsDirVfs(hgDir, HgRepositoryFiles.getSubDirRelativePaths());
myBranchHeadsDir = VcsUtil.getVirtualFile(myRepositoryFiles.getBranchHeadsDirPath());
Project project = repository.getProject();
myUpdateQueue = new QueueProcessor<Object>(new RepositoryUtil.Updater(repository), project.getDisposed());
myUpdateConfigQueue = new QueueProcessor<Object>(new Consumer<Object>() {
@Override
public void consume(Object dummy) {
repository.updateConfig();
}
}, project.getDisposed());
if (!project.isDisposed()) {
myMessageBusConnection = project.getMessageBus().connect();
myMessageBusConnection.subscribe(VirtualFileManager.VFS_CHANGES, this);
}
else {
myMessageBusConnection = null;
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:HgRepositoryUpdater.java
示例6: DebugProcess
import com.intellij.util.concurrency.QueueProcessor; //导入依赖的package包/类
public DebugProcess(@NotNull XDebugSession session,
Project project, Module module,
int port) throws IOException {
super(session);
mClassesWithStatics = new Vector<String>();
mProject = project;
mModule = module;
mDeferredQueue =
new LinkedList<Pair<debugger.Command, MessageListener>>();
mListenerQueue = new LinkedList<MessageListener>();
mServerSocket = new java.net.ServerSocket(port);
mBreakpointHandlers = this.createBreakpointHandlers();
mMap =
new HashMap<XLineBreakpoint<XBreakpointProperties>, Integer>();
mWriteQueue = QueueProcessor.createRunnableQueueProcessor(QueueProcessor.ThreadToUse.POOLED);
}
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:18,代码来源:HaxeDebugRunner.java
示例7: projectOpened
import com.intellij.util.concurrency.QueueProcessor; //导入依赖的package包/类
@Override
public void projectOpened() {
work = new ArrayListSet<InferenceCapable>();
inferenceQueueProcessor =
new QueueProcessor<InferenceCapable>(new InferenceQueue(myProject), myProject.getDisposed(), false);
StartupManager.getInstance(myProject).runWhenProjectIsInitialized(new Runnable() {
@Override
public void run() {
DumbService.getInstance(myProject).runWhenSmart(new InitRunnable());
}
});
}
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:16,代码来源:LuaPsiManager.java
示例8: SequentialLimitedLifoExecutor
import com.intellij.util.concurrency.QueueProcessor; //导入依赖的package包/类
public SequentialLimitedLifoExecutor(Disposable parentDisposable, int maxTasks,
@NotNull ThrowableConsumer<Task, ? extends Throwable> loadProcess) {
myMaxTasks = maxTasks;
myLoadProcess = loadProcess;
myLoader = new QueueProcessor<Task>(new DetailsLoadingTask());
Disposer.register(parentDisposable, this);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:SequentialLimitedLifoExecutor.java
示例9: runSafely
import com.intellij.util.concurrency.QueueProcessor; //导入依赖的package包/类
@Debugger.Insert
private void runSafely(@Nullable Runnable task) {
try {
if (!myDisposed && task != null) {
QueueProcessor.runSafely(task);
}
}
finally {
// remove from the list after execution to be able for waitForAllExecuted() to wait for completion
synchronized (LOCK) {
myRequests.remove(this);
myFuture = null;
}
}
}
开发者ID:consulo,项目名称:consulo,代码行数:16,代码来源:Alarm.java
示例10: SequentialLimitedLifoExecutor
import com.intellij.util.concurrency.QueueProcessor; //导入依赖的package包/类
public SequentialLimitedLifoExecutor(Disposable parentDisposable, int maxTasks,
@Nonnull ThrowableConsumer<Task, ? extends Throwable> loadProcess) {
myMaxTasks = maxTasks;
myLoadProcess = loadProcess;
myLoader = new QueueProcessor<>(new DetailsLoadingTask());
Disposer.register(parentDisposable, this);
}
开发者ID:consulo,项目名称:consulo,代码行数:8,代码来源:SequentialLimitedLifoExecutor.java
示例11: run
import com.intellij.util.concurrency.QueueProcessor; //导入依赖的package包/类
@Override
public void run() {
try {
if (myDisposed) {
return;
}
synchronized (LOCK) {
if (myTask == null) {
return;
}
}
final Runnable scheduledTask = new Runnable() {
@Override
public void run() {
final Runnable task;
synchronized (LOCK) {
task = myTask;
if (task == null) return;
myTask = null;
myRequests.remove(Request.this);
myFuture = null;
}
if (myThreadToUse == ThreadToUse.SWING_THREAD && !isEdt()) {
//noinspection SSBasedInspection
EdtInvocationManager.getInstance().invokeLater(new Runnable() {
@Override
public void run() {
if (!myDisposed) {
QueueProcessor.runSafely(task);
}
}
});
}
else {
QueueProcessor.runSafely(task);
}
}
@Override
public String toString() {
return "ScheduledTask "+Request.this;
}
};
if (myModalityState == null) {
Future<?> future = myExecutorService.submit(scheduledTask);
synchronized (LOCK) {
myFuture = future;
}
}
else {
final Application app = ApplicationManager.getApplication();
if (app == null) {
//noinspection SSBasedInspection
SwingUtilities.invokeLater(scheduledTask);
}
else if (app.isDispatchThread() && app.getCurrentModalityState().equals(myModalityState)) {
scheduledTask.run();
}
else {
app.invokeLater(scheduledTask, myModalityState);
}
}
}
catch (Throwable e) {
LOG.error(e);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:72,代码来源:Alarm.java
示例12: BackgroundTaskQueue
import com.intellij.util.concurrency.QueueProcessor; //导入依赖的package包/类
public BackgroundTaskQueue(@Nullable Project project, @Nonnull String title) {
myTitle = title;
Condition disposeCondition = project != null ? project.getDisposed() : ApplicationManager.getApplication().getDisposed();
myProcessor = new QueueProcessor<>(TaskData::consume, true, ThreadToUse.AWT, disposeCondition);
}
开发者ID:consulo,项目名称:consulo,代码行数:7,代码来源:BackgroundTaskQueue.java
注:本文中的com.intellij.util.concurrency.QueueProcessor类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论