Skip to content
Snippets Groups Projects
Commit a57f833e authored by Ming Han Teh's avatar Ming Han Teh
Browse files

Added close() for MongoDbClient

parent 5b19cde0
No related branches found
No related tags found
No related merge requests found
......@@ -48,9 +48,10 @@ public class MongoDbClient extends DB {
private WriteConcern writeConcern;
private String database;
@Override
/**
* Initialize any state for this DB. Called once per DB instance; there is
* one DB instance per client thread.
* Initialize any state for this DB.
* Called once per DB instance; there is one DB instance per client thread.
*/
public void init() throws DBException {
// initialize MongoDb driver
......@@ -97,6 +98,24 @@ public class MongoDbClient extends DB {
}
}
@Override
/**
* Cleanup any state for this DB.
* Called once per DB instance; there is one DB instance per client thread.
*/
public void cleanup() throws DBException
{
try {
mongo.close();
} catch (Exception e1) {
System.err.println(
"Could not close MongoDB connection pool: "
+ e1.toString());
e1.printStackTrace();
return;
}
}
@Override
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment