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

[WIP] Java 11 Region Tags #1405

Merged
merged 20 commits into from
May 7, 2019
Merged

[WIP] Java 11 Region Tags #1405

merged 20 commits into from
May 7, 2019

Conversation

averikitsch
Copy link
Contributor

No description provided.

@averikitsch averikitsch requested a review from a team May 6, 2019 19:49
@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label May 6, 2019
Copy link
Contributor

@lesv lesv left a comment

Choose a reason for hiding this comment

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

Consider the comments.

import java.util.concurrent.atomic.AtomicReference;

/** Create a persistence connection to your Firestore instance. */
public class Persistence {

private static AtomicReference<Firestore> firestore = new AtomicReference<>();
private static AtomicReference<Firestore> firestoreRef = new AtomicReference<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

You could move this inside the getFirestore method.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do I need the AtomicReference or can I just rebuild the database object? I'm not sure if this needs to be thread-safe.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ask the client library folks.

}

public static void setFirestore(Firestore firestore) {
Persistence.firestore.set(firestore);
Persistence.firestoreRef.set(firestore);
Copy link
Contributor

Choose a reason for hiding this comment

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

And use the getFirestore() method here instead of using the private member.

@averikitsch averikitsch merged commit d3d5ec4 into master May 7, 2019
@averikitsch averikitsch deleted the java11-tags branch May 7, 2019 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants