Skip to content
Snippets Groups Projects
Commit b1f8580f authored by Michi Mutsuzaki's avatar Michi Mutsuzaki
Browse files

Merge pull request #82 from minghan/a57f833e

Added close() for MongoDbClient
parents 5b19cde0 a57f833e
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