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

Refactoring. From Singleton to Factory #6

Closed
wants to merge 12 commits into from

Conversation

libraua
Copy link
Contributor

@libraua libraua commented Jul 5, 2015

No description provided.

throw new PaperDbException("Paper.init is not called");
}
if (mBookMap == null) {
mBookMap = new ConcurrentHashMap<>();
Copy link
Owner

Choose a reason for hiding this comment

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

Instantiate mBookMap in declaration. Otherwise here is a potential race condition. Changing mBookMap made by one thread would not reflect in all the other concurrent threads.

@pilgr
Copy link
Owner

pilgr commented Jul 5, 2015

Just also realized that we can support old api and mark it deprecated. Nobody likes to update library and break code. Will do it in some other patch.

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

Successfully merging this pull request may close these issues.

2 participants