mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-09 20:42:52 +07:00
deprecate ExternalSystemTaskNotificationListener.onQueued.
Swallow onStart/onEnd/onSuccess/onFailure/beforeCancel/onCancel, these events should be triggered by ES framework only (to avoid issues like IDEA-169463)
This commit is contained in:
+12
-9
@@ -15,20 +15,23 @@ public interface ExternalSystemTaskNotificationListener {
|
||||
= ExtensionPointName.create("com.intellij.externalSystemTaskNotificationListener");
|
||||
|
||||
/**
|
||||
* Notifies that task with the given id is queued for the execution.
|
||||
* <p/>
|
||||
* 'Queued' here means that intellij process-local codebase receives request to execute the target task and even has not been
|
||||
* sent it to the slave gradle api process.
|
||||
*
|
||||
* @param id target task's id
|
||||
* @param workingDir
|
||||
* @deprecated use {@link #onStart(ExternalSystemTaskId, String)}
|
||||
*/
|
||||
void onQueued(@NotNull ExternalSystemTaskId id, String workingDir);
|
||||
|
||||
|
||||
/**
|
||||
* Notifies that task with the given id is about to be started.
|
||||
*
|
||||
*
|
||||
* @param id target task's id
|
||||
* @param workingDir working directory
|
||||
*/
|
||||
default void onStart(@NotNull ExternalSystemTaskId id, String workingDir) {
|
||||
onQueued(id, workingDir);
|
||||
onStart(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #onStart(ExternalSystemTaskId, String)}
|
||||
*/
|
||||
void onStart(@NotNull ExternalSystemTaskId id);
|
||||
|
||||
|
||||
+11
-1
@@ -10,11 +10,21 @@ public abstract class ExternalSystemTaskNotificationListenerAdapter implements E
|
||||
|
||||
@NotNull public static final ExternalSystemTaskNotificationListener NULL_OBJECT = new ExternalSystemTaskNotificationListenerAdapter() { };
|
||||
|
||||
@Override
|
||||
/**
|
||||
* @deprecated use {@link #onStart(ExternalSystemTaskId, String)}
|
||||
*/
|
||||
public void onQueued(@NotNull ExternalSystemTaskId id, String workingDir) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(@NotNull ExternalSystemTaskId id, String workingDir) {
|
||||
onQueued(id, workingDir);
|
||||
onStart(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated use {@link #onStart(ExternalSystemTaskId, String)}
|
||||
*/
|
||||
public void onStart(@NotNull ExternalSystemTaskId id) {
|
||||
}
|
||||
|
||||
|
||||
+4
-36
@@ -210,14 +210,12 @@ public abstract class AbstractExternalSystemFacadeImpl<S extends ExternalSystemE
|
||||
public void onQueued(@NotNull ExternalSystemTaskId id, String workingDir) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(@NotNull ExternalSystemTaskId id, String workingDir) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(@NotNull ExternalSystemTaskId id) {
|
||||
try {
|
||||
myManager.onStart(id);
|
||||
}
|
||||
catch (RemoteException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -242,52 +240,22 @@ public abstract class AbstractExternalSystemFacadeImpl<S extends ExternalSystemE
|
||||
|
||||
@Override
|
||||
public void onEnd(@NotNull ExternalSystemTaskId id) {
|
||||
try {
|
||||
myManager.onEnd(id);
|
||||
}
|
||||
catch (RemoteException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSuccess(@NotNull ExternalSystemTaskId id) {
|
||||
try {
|
||||
myManager.onSuccess(id);
|
||||
}
|
||||
catch (RemoteException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(@NotNull ExternalSystemTaskId id, @NotNull Exception ex) {
|
||||
try {
|
||||
myManager.onFailure(id, ex);
|
||||
}
|
||||
catch (RemoteException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeCancel(@NotNull ExternalSystemTaskId id) {
|
||||
try {
|
||||
myManager.beforeCancel(id);
|
||||
}
|
||||
catch (RemoteException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel(@NotNull ExternalSystemTaskId id) {
|
||||
try {
|
||||
myManager.onCancel(id);
|
||||
}
|
||||
catch (RemoteException e) {
|
||||
// Ignore
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+5
@@ -131,6 +131,11 @@ public class ExternalSystemProcessingManager implements ExternalSystemTaskNotifi
|
||||
|
||||
@Override
|
||||
public void onQueued(@NotNull ExternalSystemTaskId id, String workingDir) {
|
||||
onStart(id, workingDir);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(@NotNull ExternalSystemTaskId id, String workingDir) {
|
||||
myTasksInProgress.put(id, System.currentTimeMillis() + TOO_LONG_EXECUTION_MS);
|
||||
if (myAlarm.getActiveRequestCount() <= 0) {
|
||||
myAlarm.addRequest(() -> update(), TOO_LONG_EXECUTION_MS);
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ public class ExternalSystemResolveProjectTask extends AbstractExternalSystemTask
|
||||
ExternalSystemProgressNotificationManagerImpl progressNotificationManager =
|
||||
(ExternalSystemProgressNotificationManagerImpl)ServiceManager.getService(ExternalSystemProgressNotificationManager.class);
|
||||
ExternalSystemTaskId id = getId();
|
||||
progressNotificationManager.onQueued(id, myProjectPath);
|
||||
progressNotificationManager.onStart(id, myProjectPath);
|
||||
try {
|
||||
DataNode<ProjectData> project = resolver.resolveProjectInfo(id, myProjectPath, myIsPreviewMode, settings);
|
||||
if (project != null) {
|
||||
|
||||
+2
-12
@@ -67,25 +67,15 @@ public class ExternalSystemProgressNotificationManagerImpl extends RemoteObject
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onQueued(@NotNull ExternalSystemTaskId id, @NotNull String workingDir) {
|
||||
public void onStart(@NotNull ExternalSystemTaskId id, @NotNull String workingDir) {
|
||||
for (Map.Entry<ExternalSystemTaskNotificationListener, Set<ExternalSystemTaskId>> entry : myListeners.entrySet()) {
|
||||
final Set<ExternalSystemTaskId> ids = entry.getValue();
|
||||
if (Collections.EMPTY_SET == ids || ids.contains(id)) {
|
||||
entry.getKey().onQueued(id, workingDir);
|
||||
entry.getKey().onStart(id, workingDir);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(@NotNull ExternalSystemTaskId id) {
|
||||
for (Map.Entry<ExternalSystemTaskNotificationListener, Set<ExternalSystemTaskId>> entry : myListeners.entrySet()) {
|
||||
final Set<ExternalSystemTaskId> ids = entry.getValue();
|
||||
if (Collections.EMPTY_SET == ids || ids.contains(id)) {
|
||||
entry.getKey().onStart(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChange(@NotNull ExternalSystemTaskNotificationEvent event) {
|
||||
for (Map.Entry<ExternalSystemTaskNotificationListener, Set<ExternalSystemTaskId>> entry : myListeners.entrySet()) {
|
||||
|
||||
+2
-8
@@ -19,11 +19,7 @@ public interface RemoteExternalSystemProgressNotificationManager extends Remote
|
||||
|
||||
RemoteExternalSystemProgressNotificationManager NULL_OBJECT = new RemoteExternalSystemProgressNotificationManager() {
|
||||
@Override
|
||||
public void onQueued(@NotNull ExternalSystemTaskId id, @NotNull String projectPath) throws RemoteException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStart(@NotNull ExternalSystemTaskId id) {
|
||||
public void onStart(@NotNull ExternalSystemTaskId id, @NotNull String projectPath) throws RemoteException {
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,9 +51,7 @@ public interface RemoteExternalSystemProgressNotificationManager extends Remote
|
||||
}
|
||||
};
|
||||
|
||||
void onQueued(@NotNull ExternalSystemTaskId id, @NotNull String projectPath) throws RemoteException;
|
||||
|
||||
void onStart(@NotNull ExternalSystemTaskId id) throws RemoteException;
|
||||
void onStart(@NotNull ExternalSystemTaskId id, @NotNull String projectPath) throws RemoteException;
|
||||
|
||||
void onStatusChange(@NotNull ExternalSystemTaskNotificationEvent event) throws RemoteException;
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import java.rmi.RemoteException;
|
||||
|
||||
/**
|
||||
* Intercepts calls to the target {@link RemoteExternalSystemProjectResolver} and
|
||||
* {@link ExternalSystemTaskNotificationListener#onQueued(ExternalSystemTaskId, String) updates 'queued' task status}.
|
||||
* {@link ExternalSystemTaskNotificationListener#onStart(ExternalSystemTaskId, String) updates 'queued' task status}.
|
||||
* <p/>
|
||||
* Thread-safe.
|
||||
*
|
||||
|
||||
+2
-1
@@ -48,9 +48,10 @@ public class ExternalSystemTaskManagerWrapper<S extends ExternalSystemExecutionS
|
||||
@NotNull String projectPath,
|
||||
@Nullable S settings,
|
||||
@Nullable String debuggerSetup) throws RemoteException, ExternalSystemException {
|
||||
myProgressManager.onQueued(id, projectPath);
|
||||
myProgressManager.onStart(id, projectPath);
|
||||
try {
|
||||
getDelegate().executeTasks(id, taskNames, projectPath, settings, debuggerSetup);
|
||||
myProgressManager.onSuccess(id);
|
||||
}
|
||||
catch (ExternalSystemException e) {
|
||||
myProgressManager.onFailure(id, e);
|
||||
|
||||
-1
@@ -253,7 +253,6 @@ public class GradleProjectResolver implements ExternalSystemProjectResolver<Grad
|
||||
myCancellationMap.putValue(resolverCtx.getExternalSystemTaskId(), new UnsupportedCancellationToken());
|
||||
}
|
||||
}
|
||||
resolverCtx.getListener().onStart(resolverCtx.getExternalSystemTaskId());
|
||||
allModels = buildActionExecutor.run();
|
||||
if (allModels == null) {
|
||||
throw new IllegalStateException("Unable to get project model for the project: " + resolverCtx.getProjectPath());
|
||||
|
||||
Reference in New Issue
Block a user