when Descriptor is manually added/removed, ExtensionList<Descriptor> needs to be updated.

This commit is contained in:
Kohsuke Kawaguchi committed 2011-03-21 00:23:00 -07:00
1 parent 50a8046b41
commit 46472e809a
2 files changed
+14 -1

No files matched your search

@@ -133,6 +133,19 @@ public class DescriptorExtensionList<T extends Describable<T>, D extends Descrip
return null;
}
@Override
public boolean add(D d) {
boolean r = super.add(d);
hudson.getExtensionList(Descriptor.class).add(d);
return r;
}
@Override
public boolean remove(Object o) {
hudson.getExtensionList(Descriptor.class).remove(o);
return super.remove(o);
}
/**
* {@link #load()} in the descriptor is not a real load activity, so locking against "this" is enough.
*/
+1 -1
View File
@@ -156,7 +156,7 @@ public class ExtensionList<T> extends AbstractList<T> {
}
@Override
public synchronized T remove(int index) {
public final synchronized T remove(int index) {
T t = get(index);
remove(t);
return t;