Bael 5369 new (#12073)
* BAEL-5369: Checking Connection to MongoDB * BAEL-5369:- Minor Fix Checking Connection to MongoDB
This commit is contained in:
+4
-4
@@ -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 {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user