Skip to content

Commit

Permalink
Hack a fix for listener overflows.
Browse files Browse the repository at this point in the history
Maybe it has something to do with Java 8 differences?
Or maybe I just changed something while working on SKM
that is horking things up when working with (old style)
SK configs.

This'll do for now, but I'll surely have to revisit when clyde gets
the love it needs.
  • Loading branch information
Ray J. Greenwell committed May 19, 2016
1 parent 3bb0e37 commit 137fbc2
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions core/src/main/java/com/threerings/config/ManagedConfig.java
Expand Up @@ -367,16 +367,26 @@ protected void getUpdateResources (HashSet<String> paths)
*/
protected void fireConfigUpdated ()
{
if (_listeners != null) {
final ConfigEvent<ManagedConfig> event = new ConfigEvent<ManagedConfig>(this, this);
_listeners.apply(new ObserverList.ObserverOp<ConfigUpdateListener<ManagedConfig>>() {
public boolean apply (ConfigUpdateListener<ManagedConfig> listener) {
listener.configUpdated(event);
return true;
}
});
// TODO: Remove need for _firing kludge?!?!
if (_firing) {
return;
}
_firing = true;
try {
if (_listeners != null) {
final ConfigEvent<ManagedConfig> event = new ConfigEvent<ManagedConfig>(this, this);
_listeners.apply(new ObserverList.ObserverOp<ConfigUpdateListener<ManagedConfig>>() {
public boolean apply (ConfigUpdateListener<ManagedConfig> listener) {
listener.configUpdated(event);
return true;
}
});
}
maybeFireOnConfigManager();

} finally {
_firing =false;
}
maybeFireOnConfigManager();
}

/**
Expand Down Expand Up @@ -451,6 +461,11 @@ protected void clearUpdateDependencies ()
@DeepOmit
protected transient WeakObserverList<ConfigUpdateListener<ManagedConfig>> _listeners;

/** Are we firing our event right now? */
// TODO: Remove! Kludge.
@DeepOmit
protected transient boolean _firing;

/** The list of configs to which we are listening for updates.
* This is usually null and is typically only used when the client creates a DConfigDirector,
* in dev environments. */
Expand Down

0 comments on commit 137fbc2

Please sign in to comment.