git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-publishing/document-store-lib-couchbase@146355 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
9b664f88a7
commit
8f67991a34
2
pom.xml
2
pom.xml
|
@ -8,7 +8,7 @@
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>org.gcube.data.publishing</groupId>
|
<groupId>org.gcube.data.publishing</groupId>
|
||||||
<artifactId>document-store-lib-couchbase</artifactId>
|
<artifactId>document-store-lib-couchbase</artifactId>
|
||||||
<version>1.3.0-SNAPSHOT</version>
|
<version>1.3.1-SNAPSHOT</version>
|
||||||
<name>Document Store CouchBase Connector</name>
|
<name>Document Store CouchBase Connector</name>
|
||||||
<description>Document Store Connector for CouchBase</description>
|
<description>Document Store Connector for CouchBase</description>
|
||||||
|
|
||||||
|
|
|
@ -125,7 +125,22 @@ public class PersistenceCouchBase extends PersistenceBackend {
|
||||||
//Bucket bucket = connectionMap.get(recordType);
|
//Bucket bucket = connectionMap.get(recordType);
|
||||||
Bucket bucket = null;
|
Bucket bucket = null;
|
||||||
synchronized (Connections.connectionsMap) {
|
synchronized (Connections.connectionsMap) {
|
||||||
|
/*
|
||||||
|
String bucketNamesValue=bucketNames.get(recordType);
|
||||||
|
logger.trace("bucketNamesValue:{}",bucketNamesValue);
|
||||||
|
|
||||||
|
Map<Nodes, Connection>conMap=Connections.connectionsMap;
|
||||||
|
logger.trace("conMap:{}",conMap.toString());
|
||||||
|
|
||||||
|
logger.debug("nodes:{}",nodes.toString());
|
||||||
|
Map<String,Bucket> mapStringBucket=conMap.get(nodes).getBucketsMap();
|
||||||
|
|
||||||
|
logger.trace("mapStringBucket:{}",mapStringBucket.toString());
|
||||||
|
bucket =mapStringBucket.get(bucketNamesValue);
|
||||||
|
*/
|
||||||
|
//Old code
|
||||||
bucket =Connections.connectionsMap.get(nodes).getBucketsMap().get(bucketNames.get(recordType));
|
bucket =Connections.connectionsMap.get(nodes).getBucketsMap().get(bucketNames.get(recordType));
|
||||||
|
try {
|
||||||
//logger.debug("PersistenceCouchBase getBucketConnection recordType:{}, bucket name:{}",recordType,bucketNames.get(recordType));
|
//logger.debug("PersistenceCouchBase getBucketConnection recordType:{}, bucket name:{}",recordType,bucketNames.get(recordType));
|
||||||
if(bucket == null){
|
if(bucket == null){
|
||||||
//bucket = cluster.openBucket(recordType, password);
|
//bucket = cluster.openBucket(recordType, password);
|
||||||
|
@ -135,6 +150,10 @@ public class PersistenceCouchBase extends PersistenceBackend {
|
||||||
Connections.connectionsMap.get(nodes).getBucketsMap().put(bucketNames.get(recordType), bucket);
|
Connections.connectionsMap.get(nodes).getBucketsMap().put(bucketNames.get(recordType), bucket);
|
||||||
logger.trace("PersistenceCouchBase getBucketConnection connectionMap:{}",Connections.connectionsMap.get(nodes).getBucketsMap());
|
logger.trace("PersistenceCouchBase getBucketConnection connectionMap:{}",Connections.connectionsMap.get(nodes).getBucketsMap());
|
||||||
}
|
}
|
||||||
|
} catch(Exception e) {
|
||||||
|
logger.error("getBucketConnection connection error", e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return bucket;
|
return bucket;
|
||||||
}
|
}
|
||||||
|
@ -178,12 +197,13 @@ public class PersistenceCouchBase extends PersistenceBackend {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void close() throws Exception {
|
public void close() throws Exception {
|
||||||
logger.debug("PersistenceCouchBase close" );
|
logger.trace("PersistenceCouchBase close" );
|
||||||
|
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void closeAndClean() throws Exception {
|
protected void closeAndClean() throws Exception {
|
||||||
synchronized (Connections.connectionsMap) {
|
synchronized (Connections.connectionsMap) {
|
||||||
|
try {
|
||||||
for (Map.Entry<String, Bucket> entry : Connections.connectionsMap.get(nodes).getBucketsMap().entrySet())
|
for (Map.Entry<String, Bucket> entry : Connections.connectionsMap.get(nodes).getBucketsMap().entrySet())
|
||||||
{
|
{
|
||||||
Boolean closed = entry.getValue().close();
|
Boolean closed = entry.getValue().close();
|
||||||
|
@ -197,13 +217,16 @@ public class PersistenceCouchBase extends PersistenceBackend {
|
||||||
}
|
}
|
||||||
Connections.connectionsMap.remove(nodes);
|
Connections.connectionsMap.remove(nodes);
|
||||||
logger.trace("PersistenceCouchBase disconnect" );
|
logger.trace("PersistenceCouchBase disconnect" );
|
||||||
|
} catch(Exception e) {
|
||||||
|
logger.error("closeAndClean error with close and clean", e);
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void closeConnection() throws Exception {
|
protected void closeConnection() throws Exception {
|
||||||
|
logger.trace("PersistenceCouchBase closeConnection" );
|
||||||
logger.debug("PersistenceCouchBase closeConnection" );
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
Reference in New Issue