removeUnloadableExtensions() for upsource

This commit is contained in:
Alexey Kudravtsev
2015-04-13 14:09:00 +03:00
parent 2290378847
commit cde9f79621
@@ -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;