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,12 +88,16 @@ public class ExtensionHandler {
collection.remove(extension);
}
extension.getExtensionObservable().removeListener(this);
synchronized (extension) {
extension.getExtensionObservable().removeListener(this);
}
}
}
}
};
extension.getExtensionObservable().addListener(respondCallback);
synchronized (extension) {
extension.getExtensionObservable().addListener(respondCallback);
}
}
}
@ -104,7 +108,9 @@ public class ExtensionHandler {
synchronized (collection2) {
for (GEarthExtension extension : collection2) {
extension.packetIntercept(new HMessage(message));
synchronized (extension) {
extension.packetIntercept(new HMessage(message));
}
}
}

View File

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