small change synchronization extensions

This commit is contained in:
sirjonasxx 2020-06-01 11:23:25 +02:00
parent 6de0761180
commit 58e455142a
2 changed files with 10 additions and 4 deletions

View File

@ -88,14 +88,18 @@ public class ExtensionHandler {
collection.remove(extension); collection.remove(extension);
} }
synchronized (extension) {
extension.getExtensionObservable().removeListener(this); extension.getExtensionObservable().removeListener(this);
} }
} }
} }
}
}; };
synchronized (extension) {
extension.getExtensionObservable().addListener(respondCallback); extension.getExtensionObservable().addListener(respondCallback);
} }
} }
}
Set<GEarthExtension> collection2; Set<GEarthExtension> collection2;
synchronized (collection) { synchronized (collection) {
@ -104,9 +108,11 @@ public class ExtensionHandler {
synchronized (collection2) { synchronized (collection2) {
for (GEarthExtension extension : collection2) { for (GEarthExtension extension : collection2) {
synchronized (extension) {
extension.packetIntercept(new HMessage(message)); extension.packetIntercept(new HMessage(message));
} }
} }
}
//block untill all extensions have responded //block untill all extensions have responded
List<GEarthExtension> willdelete = new ArrayList<>(); List<GEarthExtension> willdelete = new ArrayList<>();

View File

@ -48,7 +48,7 @@ public abstract class GEarthExtension {
// ----------------- listen to the extension --------------------- // ----------------- listen to the extension ---------------------
protected final Observable<ExtensionListener> extensionObservable = new Observable<>(); protected final Observable<ExtensionListener> extensionObservable = new SynchronizedObservable<>();
public Observable<ExtensionListener> getExtensionObservable() { public Observable<ExtensionListener> getExtensionObservable() {
return extensionObservable; return extensionObservable;
} }