-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Conversation
There was a problem hiding this 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<>(); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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.
No description provided.