Bael 5369 new (#12073)

* BAEL-5369: Checking Connection to MongoDB

* BAEL-5369:- Minor Fix Checking Connection to MongoDB
This commit is contained in:
Kapil Khandelwal
2022-04-19 05:05:55 +05:30
committed by GitHub
parent f4c4d890d6
commit 09d6595514
2 changed files with 8 additions and 31 deletions
@@ -7,7 +7,7 @@ import com.mongodb.ServerAddress;
public class ConnectionCheck {
public static void checkingConnection() {
public static MongoClient checkingConnection() {
MongoClientOptions.Builder builder = MongoClientOptions.builder();
@@ -27,9 +27,10 @@ public class ConnectionCheck {
System.out.println(db.getStats());
} catch (Exception e) {
System.out.println("MongoDB Server is Down");
mongoClient.close();
}
return mongoClient;
}
public static void main(String[] args) {
@@ -42,5 +43,4 @@ public class ConnectionCheck {
}
}
}