Browse Source

removed synchronicity checks

master
Jaryl Chng 1 year ago
parent
commit
19c165d124
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      common/src/main/java/com/jarylchng/reactivemongoexample/common/User.java

+ 4
- 4
common/src/main/java/com/jarylchng/reactivemongoexample/common/User.java View File

@ -71,11 +71,11 @@ public class User {
private volatile static MongoCollection<User> collection = database.getCollection("user", User.class)
.withCodecRegistry(pojoCodecRegistry);
public synchronized static Single<User> findByID(String id) {
public static Single<User> findByID(String id) {
return Single.fromPublisher(collection.find(eq("userID", id)).first());
}
public synchronized static Single<Success> insert(User user) {
public static Single<Success> insert(User user) {
return Single.fromPublisher(collection.insertOne(user));
}
@ -91,11 +91,11 @@ public class User {
private volatile static com.mongodb.client.MongoCollection<User> collection = database.getCollection("user", User.class)
.withCodecRegistry(pojoCodecRegistry);
public synchronized static User findByID(String id) {
public static User findByID(String id) {
return collection.find(eq("userID", id)).first();
}
public synchronized static void insert(User user) {
public static void insert(User user) {
collection.insertOne(user);
}

Loading…
Cancel
Save