本文整理汇总了Java中com.intellij.concurrency.JobScheduler类的典型用法代码示例。如果您正苦于以下问题:Java JobScheduler类的具体用法?Java JobScheduler怎么用?Java JobScheduler使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JobScheduler类属于com.intellij.concurrency包,在下文中一共展示了JobScheduler类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: cancelAndRestartDaemonLater
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
private static void cancelAndRestartDaemonLater(@NotNull ProgressIndicator progress,
@NotNull final Project project) throws ProcessCanceledException {
progress.cancel();
JobScheduler.getScheduler().schedule(new Runnable() {
@Override
public void run() {
Application application = ApplicationManager.getApplication();
if (!project.isDisposed() && !application.isDisposed() && !application.isUnitTestMode()) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
DaemonCodeAnalyzer.getInstance(project).restart();
}
}, project.getDisposed());
}
}
}, RESTART_DAEMON_RANDOM.nextInt(100), TimeUnit.MILLISECONDS);
throw new ProcessCanceledException();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:GeneralHighlightingPass.java
示例2: LocalFileSystemImpl
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
public LocalFileSystemImpl(@NotNull ManagingFS managingFS) {
myManagingFS = managingFS;
myWatcher = new FileWatcher(myManagingFS);
if (myWatcher.isOperational()) {
final int PERIOD = 1000;
Runnable runnable = new Runnable() {
public void run() {
final Application application = ApplicationManager.getApplication();
if (application == null || application.isDisposed()) return;
storeRefreshStatusToFiles();
JobScheduler.getScheduler().schedule(this, PERIOD, TimeUnit.MILLISECONDS);
}
};
JobScheduler.getScheduler().schedule(runnable, PERIOD, TimeUnit.MILLISECONDS);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:LocalFileSystemImpl.java
示例3: openFatals
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
public void openFatals(@Nullable final LogMessage message) {
if (myDialog != null) return;
if (myOpeningInProgress) return;
myOpeningInProgress = true;
final Runnable task = new Runnable() {
public void run() {
if (isOtherModalWindowActive()) {
if (myDialog == null) {
JobScheduler.getScheduler().schedule(this, (long)300, TimeUnit.MILLISECONDS);
}
return;
}
try {
_openFatals(message);
}
finally {
myOpeningInProgress = false;
}
}
};
task.run();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:IdeMessagePanel.java
示例4: startBlinker
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
private synchronized void startBlinker() {
if (myBlinker != null) {
return;
}
myBlinker = JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
boolean enabled = false;
@Override
public void run() {
myIcon.setLayerEnabled(0, enabled);
myIcon.setLayerEnabled(1, false);
myIcon.setLayerEnabled(2, !enabled);
repaint();
enabled = !enabled;
}
}, 1, 1, TimeUnit.SECONDS);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:IdeFatalErrorsIcon.java
示例5: startBackgroundIndicatorPing
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
@NotNull
private ScheduledFuture<?> startBackgroundIndicatorPing() {
return JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
for (ProgressIndicator indicator : nonStandardIndicators) {
try {
indicator.checkCanceled();
}
catch (ProcessCanceledException e) {
indicatorCanceled(indicator);
}
}
}
}, 0, CHECK_CANCELED_DELAY_MILLIS, TimeUnit.MILLISECONDS);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:CoreProgressManager.java
示例6: queueChange
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
private void queueChange(VirtualFile vf) {
// Since we are working with VirtualFile, they are not necessarily part of the project.
// Check that the file is in the import roots as a proxy for belonging to the project
// (alternatively check if it's under the workspace root?).
if (vf == null || !vf.isValid() || !isInImportRoots(vf)) {
return;
}
queuedFiles.add(vf);
if (!flushIsQueued.compareAndSet(false, true)) {
return;
}
@SuppressWarnings("unused") // go/futurereturn-lsc
Future<?> possiblyIgnoredError =
JobScheduler.getScheduler()
.schedule(
() ->
ApplicationManager.getApplication()
.invokeLater(this::flushQueue, ModalityState.NON_MODAL),
DELAY_TIME_MS,
TimeUnit.MILLISECONDS);
}
开发者ID:bazelbuild,项目名称:intellij,代码行数:22,代码来源:BulkSymbolTableBuildingChangeListener.java
示例7: run
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
/** Main run function. */
@Override
public void run() {
if (future != null && !future.isCancelled() && !future.isDone()) {
return;
}
if (leading) {
task.run();
}
future = JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
task.run();
if (++attempt >= maxAttempts || trailingTask) {
trailing = false;
if (future != null) {
future.cancel(false);
}
}
}
}, delay, delay, TimeUnit.MILLISECONDS);
}
开发者ID:hsz,项目名称:idea-gitignore,代码行数:23,代码来源:InterruptibleScheduledFuture.java
示例8: openFatals
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
public void openFatals(@Nullable final LogMessage message) {
if (myDialog != null) return;
if (myOpeningInProgress) return;
myOpeningInProgress = true;
final Runnable task = new Runnable() {
@Override
public void run() {
if (isOtherModalWindowActive()) {
if (myDialog == null) {
JobScheduler.getScheduler().schedule(this, (long)300, TimeUnit.MILLISECONDS);
}
return;
}
try {
_openFatals(message);
}
finally {
myOpeningInProgress = false;
}
}
};
task.run();
}
开发者ID:consulo,项目名称:consulo,代码行数:27,代码来源:IdeMessagePanel.java
示例9: cancel
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
/**
* @return task if not yet executed
*/
@Nullable
private Runnable cancel() {
synchronized (LOCK) {
if (myFuture != null) {
myFuture.cancel(false);
// TODO Use java.util.concurrent.ScheduledThreadPoolExecutor.setRemoveOnCancelPolicy(true) when on jdk 1.7
((ScheduledThreadPoolExecutor)JobScheduler.getScheduler()).remove((Runnable)myFuture);
myFuture = null;
}
Runnable task = myTask;
myTask = null;
return task;
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:Alarm.java
示例10: scheduleNextRepaint
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
private void scheduleNextRepaint() {
if (myScheduledFuture != null && !myScheduledFuture.isDone()) {
myScheduledFuture.cancel(false);
}
myCalendar.setTimeInMillis(System.currentTimeMillis());
myScheduledFuture = JobScheduler.getScheduler().schedule(new Runnable() {
@Override
public void run() {
UIUtil.invokeLaterIfNeeded(myRepaintRunnable);
}
}, 60 - myCalendar.get(SECOND), TimeUnit.SECONDS);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:ClockPanel.java
示例11: MemoryUsagePanel
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
public MemoryUsagePanel() {
setOpaque(false);
setFocusable(false);
addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.gc();
updateState();
}
});
setBorder(StatusBarWidget.WidgetBorder.INSTANCE);
updateUI();
new UiNotifyConnector(this, new Activatable() {
private ScheduledFuture<?> myFuture;
@Override
public void showNotify() {
myFuture = JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
public void run() {
if (isDisplayable()) {
updateState();
}
}
}, 1, 5, TimeUnit.SECONDS);
}
@Override
public void hideNotify() {
if (myFuture != null) {
myFuture.cancel(true);
myFuture = null;
}
}
});
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:39,代码来源:MemoryUsagePanel.java
示例12: updateRefreshTimer
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
private void updateRefreshTimer() {
cancelRefreshTimer();
if (myState.isRefreshEnabled()) {
myRefresnRunnable = new MyRefreshRunnable(this);
// if "schedule with fixed rate" is used, then after waking up from stand-by mode, events are generated for inactive period
// it does not make sense
myFuture = JobScheduler.getScheduler().scheduleWithFixedDelay(myRefresnRunnable,
myState.getRefreshInterval()*60, myState.getRefreshInterval()*60,
TimeUnit.SECONDS);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:CommittedChangesCache.java
示例13: checkAndOpenPageLater
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
private void checkAndOpenPageLater(@NotNull final HostAndPort hostAndPort, final int attemptNumber, int delayMillis) {
JobScheduler.getScheduler().schedule(new Runnable() {
@Override
public void run() {
checkAndOpenPage(hostAndPort, attemptNumber);
}
}, delayMillis, TimeUnit.MILLISECONDS);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:BrowserStarter.java
示例14: openPageLater
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
private void openPageLater(int millis) {
JobScheduler.getScheduler().schedule(new Runnable() {
@Override
public void run() {
openPageNow();
}
}, millis, TimeUnit.MILLISECONDS);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:BrowserStarter.java
示例15: checkCreatedProcess
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
@Override
protected void checkCreatedProcess(@Nullable final WebBrowser browser,
@Nullable final Project project,
@NotNull final GeneralCommandLine commandLine,
@NotNull final Process process,
@Nullable final Runnable launchTask) {
if (isOpenCommandUsed(commandLine)) {
final Future<?> future = ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
try {
if (process.waitFor() == 1) {
showError(ExecUtil.readFirstLine(process.getErrorStream(), null), browser, project, null, launchTask);
}
}
catch (InterruptedException ignored) {
}
}
});
// 10 seconds is enough to start
JobScheduler.getScheduler().schedule(new Runnable() {
@Override
public void run() {
future.cancel(true);
}
}, 10, TimeUnit.SECONDS);
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:BrowserLauncherImpl.java
示例16: activate
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
public void activate() {
busConnection = myVcs.getProject().getMessageBus().connect();
busConnection.subscribe(HgVcs.REMOTE_TOPIC, this);
int checkIntervalSeconds = HgGlobalSettings.getIncomingCheckIntervalSeconds();
changesUpdaterScheduledFuture = JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
public void run() {
update(myVcs.getProject());
}
}, 5, checkIntervalSeconds, TimeUnit.SECONDS);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:HgRemoteStatusUpdater.java
示例17: cancel
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
private void cancel() {
synchronized (LOCK) {
if (myFuture != null) {
myFuture.cancel(false);
// TODO Use java.util.concurrent.ScheduledThreadPoolExecutor.setRemoveOnCancelPolicy(true) when on jdk 1.7
((ScheduledThreadPoolExecutor)JobScheduler.getScheduler()).remove((Runnable)myFuture);
myFuture = null;
}
myTask = null;
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:12,代码来源:Alarm.java
示例18: addNotify
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
/**
* Invoked when enclosed frame is being shown.
*/
@Override
public void addNotify() {
myFuture = JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
public void run() {
if (isDisplayable()) {
updateState();
}
}
}, 1, 5, TimeUnit.SECONDS);
super.addNotify();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:MemoryUsagePanel.java
示例19: ProgressManagerImpl
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
public ProgressManagerImpl(Application application) {
if (/*!application.isUnitTestMode() && */!DISABLED) {
myCheckCancelledFuture = JobScheduler.getScheduler().scheduleWithFixedDelay(new Runnable() {
@Override
public void run() {
ourNeedToCheckCancel = true;
ProgressIndicatorProvider.ourNeedToCheckCancel = true;
}
}, 0, 10, TimeUnit.MILLISECONDS);
}
else {
myCheckCancelledFuture = null;
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:15,代码来源:ProgressManagerImpl.java
示例20: run
import com.intellij.concurrency.JobScheduler; //导入依赖的package包/类
/** Wrapper run() method to invoke {@link #timer} properly. */
public final void run(@Nullable final T argument) {
if (timer != null) {
timer.cancel(false);
}
timer = JobScheduler.getScheduler().schedule(new DumbAwareRunnable() {
@Override
public void run() {
task(argument);
}
}, delay, TimeUnit.MILLISECONDS);
}
开发者ID:hsz,项目名称:idea-gitignore,代码行数:14,代码来源:Debounced.java
注:本文中的com.intellij.concurrency.JobScheduler类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论