com.intellij.util.concurrency.QueueProcessor Java Examples

The following examples show how to use com.intellij.util.concurrency.QueueProcessor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: HaxeDebugRunner.java    From intellij-haxe with Apache License 2.0 6 votes vote down vote up
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);
}
 
Example #2
Source File: Alarm.java    From consulo with Apache License 2.0 5 votes vote down vote up
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 {@link #waitForAllExecuted(long, TimeUnit)} to wait for completion */
    synchronized (LOCK) {
      myRequests.remove(this);
      myFuture = null;
    }
  }
}
 
Example #3
Source File: SequentialLimitedLifoExecutor.java    From consulo with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example #4
Source File: FlutterConsoleLogManager.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public FlutterConsoleLogManager(@NotNull ConsoleView console, @NotNull FlutterApp app) {
  this.console = console;
  this.app = app;

  assert (app.getVmService() != null);
  this.service = app.getVmService();

  app.addStateListener(new FlutterApp.FlutterAppListener() {
    @Override
    public void notifyFrameRendered() {
      frameErrorCount = 0;
    }

    @Override
    public void stateChanged(FlutterApp.State newState) {
      frameErrorCount = 0;
    }

    @Override
    public void notifyAppReloaded() {
      frameErrorCount = 0;
    }

    @Override
    public void notifyAppRestarted() {
      frameErrorCount = 0;
    }
  });

  assert (app.getFlutterDebugProcess() != null);
  objectGroup = InspectorService.createGroup(app, app.getFlutterDebugProcess(), app.getVmService(), "console-group");
  objectGroup.whenCompleteAsync((group, error) -> {
    if (group != null) {
      Disposer.register(app, group.getInspectorService());
    }
  });

  if (queue == null) {
    queue = QueueProcessor.createRunnableQueueProcessor();
  }
}
 
Example #5
Source File: FlutterConsoleLogManager.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public FlutterConsoleLogManager(@NotNull ConsoleView console, @NotNull FlutterApp app) {
  this.console = console;
  this.app = app;

  assert (app.getVmService() != null);
  this.service = app.getVmService();

  app.addStateListener(new FlutterApp.FlutterAppListener() {
    @Override
    public void notifyFrameRendered() {
      frameErrorCount = 0;
    }

    @Override
    public void stateChanged(FlutterApp.State newState) {
      frameErrorCount = 0;
    }

    @Override
    public void notifyAppReloaded() {
      frameErrorCount = 0;
    }

    @Override
    public void notifyAppRestarted() {
      frameErrorCount = 0;
    }
  });

  assert (app.getFlutterDebugProcess() != null);
  objectGroup = InspectorService.createGroup(app, app.getFlutterDebugProcess(), app.getVmService(), "console-group");
  objectGroup.whenCompleteAsync((group, error) -> {
    if (group != null) {
      Disposer.register(app, group.getInspectorService());
    }
  });

  if (queue == null) {
    queue = QueueProcessor.createRunnableQueueProcessor();
  }
}
 
Example #6
Source File: BackgroundTaskQueue.java    From consulo with Apache License 2.0 4 votes vote down vote up
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);
}