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

Remove external cache locking #159

Closed
emacarron opened this Issue Mar 11, 2014 · 0 comments

Comments

Projects
None yet
1 participant
@emacarron
Member

emacarron commented Mar 11, 2014

MyBatis gets a ReadWriteLock from the cache provider and calls read.lock() and write.lock() when calling getObject() and putObject().

The default cache provides its own Synchronized decorator that makes sure that accesses to cache are properly synchronized. So in this case we are doing two locks and only one is needed.

In the case of 3rd party cache providers like Hazelcast, EhCache... they already provide sharper locking and do not need any extra external locking.

This change may affect those that have implemented or extended the MyBatis default cache.

From now over Cache implementors can just return null in getReadWriteLock method.

@emacarron emacarron added this to the 3.2.6 milestone Mar 11, 2014

@emacarron emacarron self-assigned this Mar 11, 2014

@emacarron emacarron closed this in ddc48a7 Mar 11, 2014

qlp added a commit to qlp/mybatis-3 that referenced this issue Jun 18, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment