Your method is thread-safe since you're only reading from the DB.
(and even if you were writing, I'm sure your DB can handle concurrent writes)
Is it safe to use static methods in a Play model
-
06-10-2022 - |
Question
In Play 2.0m I have a static method in my model to wrap searching the DB:
public static User findUserByEmail(String email) {
Finder<String, User> find = new Finder<String, User>(String.class, User.class);
return find.where().eq("email", email).findUnique();
}
Is this threadsafe? I saw How Playframework 1.x static method works in a thread safe way but I don't know if that applies to the models too.
La solution
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow