mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[Dynamic plugins] cleanup Jps extension cache on plugin unload IDEA-238179
GitOrigin-RevId: cfccfb31c3e7cf7fcdfc561d73e6628520bf4ca7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1694b3a546
commit
8884c099fd
@@ -1,22 +1,9 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package org.jetbrains.jps.service.impl;
|
||||
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.jps.plugin.JpsPluginManager;
|
||||
import org.jetbrains.jps.service.JpsServiceManager;
|
||||
@@ -82,16 +69,19 @@ public class JpsServiceManagerImpl extends JpsServiceManager {
|
||||
return (List<T>)cached;
|
||||
}
|
||||
|
||||
private boolean cleanupExtensionCache() {
|
||||
JpsPluginManager manager = myPluginManager;
|
||||
if (manager != null) {
|
||||
int stamp = manager.getModificationStamp();
|
||||
if (myModificationStamp.getAndSet(stamp) != stamp) {
|
||||
myExtensions.clear();
|
||||
return true;
|
||||
@ApiStatus.Internal
|
||||
public boolean cleanupExtensionCache() {
|
||||
synchronized (myExtensions) {
|
||||
JpsPluginManager manager = myPluginManager;
|
||||
if (manager != null) {
|
||||
int stamp = manager.getModificationStamp();
|
||||
if (myModificationStamp.getAndSet(stamp) != stamp) {
|
||||
myExtensions.clear();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.jps.impl;
|
||||
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.extensions.*;
|
||||
import com.intellij.openapi.extensions.ExtensionPoint;
|
||||
import com.intellij.openapi.extensions.ExtensionPointListener;
|
||||
import com.intellij.openapi.extensions.ExtensionsArea;
|
||||
import com.intellij.openapi.extensions.PluginDescriptor;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
@@ -27,6 +30,8 @@ import org.jetbrains.jps.model.serialization.module.JpsModuleRootModelSerializer
|
||||
import org.jetbrains.jps.model.serialization.module.JpsModuleSourceRootPropertiesSerializer;
|
||||
import org.jetbrains.jps.model.serialization.module.UnknownSourceRootPropertiesSerializer;
|
||||
import org.jetbrains.jps.plugin.JpsPluginManager;
|
||||
import org.jetbrains.jps.service.JpsServiceManager;
|
||||
import org.jetbrains.jps.service.impl.JpsServiceManagerImpl;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
@@ -126,6 +131,10 @@ public final class JpsIdePluginManagerImpl extends JpsPluginManager {
|
||||
}
|
||||
myExternalBuildPlugins.remove(pluginDescriptor);
|
||||
myModificationStamp.incrementAndGet();
|
||||
JpsServiceManager jpsServiceManager = JpsServiceManager.getInstance();
|
||||
if (jpsServiceManager instanceof JpsServiceManagerImpl) {
|
||||
((JpsServiceManagerImpl)jpsServiceManager).cleanupExtensionCache();
|
||||
}
|
||||
}
|
||||
|
||||
private void handlePluginAdded(@NotNull PluginDescriptor pluginDescriptor) {
|
||||
|
||||
Reference in New Issue
Block a user