removed close method for mongo client. Now the connection pool is

managed by java driver, upgrade mongo-java-driver to 3.12. Deprecated
getUrl method
This commit is contained in:
Roberto Cirillo 2021-03-12 17:24:49 +01:00
parent 2f2ddfad4a
commit 53a52fdc31
6 changed files with 22 additions and 16 deletions

View File

@ -2,6 +2,8 @@
## [v3.1.0-SNAPSHOT]
* upgrade mongo-java-client to version 3.12.0
* removed close method for mongo client. Now the connection pool is managed by java driver
* deprecated getUrl method
## [v3.0.1-SNAPSHOT]

View File

@ -8,7 +8,7 @@
</parent>
<groupId>org.gcube.contentmanagement</groupId>
<artifactId>storage-manager-core</artifactId>
<version>3.0.1-SNAPSHOT</version>
<version>3.1.0-SNAPSHOT</version>
<scm>
<connection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</connection>
<developerConnection>scm:git:https://code-repo.d4science.org/gCubeSystem/${project.artifactId}.git</developerConnection>

View File

@ -96,6 +96,7 @@ public RemoteResourceInfo renewTTL(String key);
*
* @return RemoteResource object
*/
@Deprecated
RemoteResource getUrl();
/**

View File

@ -779,6 +779,9 @@ public class MongoIOManager {
}
public BasicDBObject findMetaCollectionObject(String source) throws UnknownHostException {
//set to null in order to perform a query as BasicDBObject and not GridFSObject
db=null;
mongo=null;
DBCollection fileCollection=getConnectionDB(dbName, false).getCollection(Costants.DEFAULT_META_COLLECTION);
BasicDBObject query = new BasicDBObject();
BasicDBObject obj=null;
@ -1048,11 +1051,11 @@ public class MongoIOManager {
* the old close method
*/
protected void clean() {
if(mongo!=null)
mongo.close();
mongo=null;
if(db!=null)
db=null;
// if(mongo!=null)
// mongo.close();
// mongo=null;
// if(db!=null)
// db=null;
}
/**
@ -1062,12 +1065,12 @@ public class MongoIOManager {
*/
public void close() {
if(mongo!=null)
mongo.close();
logger.info("Mongo has been closed");
mongo=null;
gfs=null;
db=null;
// if(mongo!=null)
// mongo.close();
// logger.info("Mongo has been closed");
// mongo=null;
// gfs=null;
// db=null;
}
public void removeGFSFile(GridFSDBFile f, ObjectId idF){

View File

@ -31,8 +31,8 @@ public class MongoInputStream extends ProxyInputStream{
} catch (IOException e) {
e.printStackTrace();
}
if (mongo!=null)
mongo.close();
// if (mongo!=null)
// mongo.close();
setClosed(true);
}
}

View File

@ -66,8 +66,8 @@ public class MongoOutputStream extends ProxyOutputStream {
// TODO Auto-generated catch block
e.printStackTrace();
}
mongo.close();
setClosed(true);
// mongo.close();
// setClosed(true);
}
}