mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
do not hardcode to BoundedTaskExecutor private implementation details
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.util.io.BufferExposingByteArrayOutputStream;
|
||||
import com.intellij.openapi.util.io.FileSystemUtil;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.concurrency.Semaphore;
|
||||
import com.intellij.util.concurrency.SequentialTaskExecutor;
|
||||
import com.intellij.util.io.DataOutputStream;
|
||||
import io.netty.channel.Channel;
|
||||
@@ -49,7 +50,6 @@ import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
import static org.jetbrains.jps.api.CmdlineRemoteProto.Message.ControllerMessage.ParametersMessage.TargetTypeBuildScope;
|
||||
|
||||
@@ -64,7 +64,7 @@ final class BuildSession implements Runnable, CanceledStatus {
|
||||
private final Channel myChannel;
|
||||
@Nullable
|
||||
private final PreloadedData myPreloadedData;
|
||||
private volatile boolean myCanceled = false;
|
||||
private volatile boolean myCanceled;
|
||||
private final String myProjectPath;
|
||||
@Nullable
|
||||
private CmdlineRemoteProto.Message.ControllerMessage.FSEvent myInitialFSDelta;
|
||||
@@ -345,7 +345,7 @@ final class BuildSession implements Runnable, CanceledStatus {
|
||||
}
|
||||
|
||||
public void processFSEvent(final CmdlineRemoteProto.Message.ControllerMessage.FSEvent event) {
|
||||
myEventsProcessor.submit(new Runnable() {
|
||||
myEventsProcessor.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
@@ -646,23 +646,21 @@ final class BuildSession implements Runnable, CanceledStatus {
|
||||
}
|
||||
|
||||
private static class EventsProcessor extends SequentialTaskExecutor {
|
||||
private final AtomicBoolean myProcessingEnabled = new AtomicBoolean(false);
|
||||
private final Semaphore myProcessingEnabled = new Semaphore();
|
||||
|
||||
EventsProcessor() {
|
||||
private EventsProcessor() {
|
||||
super(SharedThreadPool.getInstance());
|
||||
myProcessingEnabled.down();
|
||||
execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myProcessingEnabled.waitFor();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void startProcessing() {
|
||||
if (!myProcessingEnabled.getAndSet(true)) {
|
||||
super.processQueue();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processQueue() {
|
||||
if (myProcessingEnabled.get()) {
|
||||
super.processQueue();
|
||||
}
|
||||
private void startProcessing() {
|
||||
myProcessingEnabled.up();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user