mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
removeUnloadableExtensions() for upsource
This commit is contained in:
+15
-2
@@ -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.
|
||||
@@ -261,6 +261,19 @@ public class ExtensionPointImpl<T> implements ExtensionPoint<T> {
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") // upsource
|
||||
public synchronized void removeUnloadableExtensions() {
|
||||
ExtensionComponentAdapter[] adapters = myExtensionAdapters.toArray(new ExtensionComponentAdapter[myExtensionAdapters.size()]);
|
||||
for (ExtensionComponentAdapter adapter : adapters) {
|
||||
try {
|
||||
adapter.getComponentImplementation();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
unregisterExtensionAdapter(adapter);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public T getExtension() {
|
||||
@@ -423,7 +436,7 @@ public class ExtensionPointImpl<T> implements ExtensionPoint<T> {
|
||||
myExtensionsCache = null;
|
||||
}
|
||||
|
||||
synchronized boolean unregisterExtensionAdapter(@NotNull ExtensionComponentAdapter adapter) {
|
||||
public synchronized boolean unregisterExtensionAdapter(@NotNull ExtensionComponentAdapter adapter) {
|
||||
try {
|
||||
if (myExtensionAdapters.remove(adapter)) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user