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

Fix #3997. Make SupplierFactoryBridge thread-safe. #4000

Closed
wants to merge 1 commit into from
Closed

Fix #3997. Make SupplierFactoryBridge thread-safe. #4000

wants to merge 1 commit into from

Conversation

buri17
Copy link

@buri17 buri17 commented Dec 1, 2018

This makes SupplierFactoryBridge thread-safe and avoids #3997.

@jansupol
Copy link
Contributor

jansupol commented Dec 3, 2018

Please see Missing-ECA,-Missing-Sign-off

@buri17
Copy link
Author

buri17 commented Dec 3, 2018

Please see Missing-ECA,-Missing-Sign-off

I have added "Signed-off-by" entry to new commit, created eclipse account and signed ECA.

@jansupol
Copy link
Contributor

jansupol commented Dec 3, 2018

There is a valid ECA on file for buri17@gmail.com.

synchronized (disposableSuppliers) {
DisposableSupplier<T> disposableSupplier = disposableSuppliers.get(instance);
disposableSupplier.dispose(instance);
disposableSuppliers.remove(instance);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This block is too wide - it synchronizes also the disposal of the supplier
Change this block:

DisposableSupplier<T> disposableSupplier = disposableSuppliers.remove(instance);
disposableSupplier.dispose(instance);

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would still replace the current implementation with the one I proposed.
I would rather call a single method (remove) than two methods (get and remove) on a synchronized object.

Signed-off-by: MIURA Toru <buri17@gmail.com>
@buri17
Copy link
Author

buri17 commented Dec 28, 2018

@tomas-langer I have changed the code according to your comments. Can you review it again?

@tomas-langer
Copy link
Contributor

@buri17 I have updated the review comments - one still pending. Thanks and sorry for delay!

@hypnoce
Copy link
Contributor

hypnoce commented Jun 25, 2019

I believe I ran into the same issue. I randomly got an NPE here

@jansupol
Copy link
Contributor

Closing in favor of #4178.

@jansupol jansupol closed this Aug 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants