Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible issues w/ PropertyWrapper? #468

Closed
pkwarren opened this issue Dec 16, 2016 · 4 comments
Closed

Possible issues w/ PropertyWrapper? #468

pkwarren opened this issue Dec 16, 2016 · 4 comments

Comments

@pkwarren
Copy link

When looking at the implementation of PropertyWrapper, I've seen two potential issues for consumers of this API:

  • PropertyWrapper wraps a DynamicProperty (which is thread safe), but appears to not be thread safe itself (specifically the callbackList field). It would be useful to document this (that addCallback and removeAllCallbacks should be synchronized) or perhaps switch the callbackList to a CopyOnWriteArrayList similar to DynamicProperty. Reference:
    private final List<Runnable> callbackList = Lists.newArrayList();
  • In removeAllCallbacks, the callback is removed from DynamicProperty but the entry in callbackList is not removed. This will lead to a resource leak over time as there doesn't appear to be a way to remove callbacks from callbackList. Reference:
    /**
    * Remove all callbacks registered through this instance of property
    */
    @Override
    public void removeAllCallbacks() {
    for (Runnable callback: callbackList) {
    prop.removeCallback(callback);
    }
    }

I can raise a PR to resolve these issues.

@howardyuan
Copy link
Contributor

@pkwarren Sure, please raise a PR so we can look at it together. Thanks.

@pkwarren
Copy link
Author

@howardyuan - Opened #470 with a proposed fix for these issues.

@pkwarren
Copy link
Author

@howardyuan - Have you had a chance to look at this PR?

@rgallardo-netflix
Copy link
Contributor

won't fix: v1 has been deprecated

@rgallardo-netflix rgallardo-netflix closed this as not planned Won't fix, can't repro, duplicate, stale Feb 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants