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

Fixes possible leak caused by concurrent add/remove of IMap interceptors #7531

Merged

Conversation

ahmetmircik
Copy link
Member

Fixes the leak which is introduced in PR #3993

closes #7520

@ahmetmircik ahmetmircik added this to the 3.7 milestone Feb 16, 2016
@ahmetmircik ahmetmircik force-pushed the fix/3.7/interceptorAddRemoveLeak branch 4 times, most recently from 181ec3c to 4fb119c Compare February 16, 2016 15:57
@ahmetmircik ahmetmircik changed the title Fixes interceptor concurrent add/remove leak Fixes possible leak caused by concurrent add/remove of IMap interceptors Feb 16, 2016
@ahmetmircik ahmetmircik force-pushed the fix/3.7/interceptorAddRemoveLeak branch 5 times, most recently from 35c11be to fc29a6f Compare February 17, 2016 10:50
Map<String, MapInterceptor> tmpMap = new HashMap<String, MapInterceptor>(id2InterceptorMap);
tmpMap.put(id, interceptor);

id2InterceptorMap = tmpMap;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also wrap with Collections.unmodifiableMap()? Readers should not be able to modify.

id2InterceptorMap = Collections.unmodifiableMap(tmpMap);

Copy link
Member Author

Choose a reason for hiding this comment

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

done.

@ahmetmircik ahmetmircik force-pushed the fix/3.7/interceptorAddRemoveLeak branch from fc29a6f to bdf6fd9 Compare February 17, 2016 12:06
@mdogan
Copy link
Contributor

mdogan commented Feb 17, 2016

👍

@mdogan
Copy link
Contributor

mdogan commented Feb 17, 2016

Will you backport this?

@gurbuzali
Copy link
Contributor

👍

gurbuzali pushed a commit that referenced this pull request Feb 17, 2016
…eLeak

Fixes possible leak caused by concurrent add/remove of IMap interceptors
@gurbuzali gurbuzali merged commit 2cfcc5e into hazelcast:master Feb 17, 2016
@ahmetmircik
Copy link
Member Author

@mdogan backport is on the way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Source: Internal PR or issue was opened by an employee Team: Core Type: Defect
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Thread safety on MapContainer.addInterceptor
4 participants