Check if connection is closed
git-svn-id: https://svn.d4science.research-infrastructures.eu/gcube/trunk/data-publishing/document-store-lib-couchbase@148258 82a268e6-3cf1-43bd-a215-b396298e98cf
This commit is contained in:
parent
8f67991a34
commit
7c345d40b4
|
@ -30,6 +30,7 @@
|
||||||
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
|
||||||
<attributes>
|
<attributes>
|
||||||
<attribute name="maven.pomderived" value="true"/>
|
<attribute name="maven.pomderived" value="true"/>
|
||||||
|
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
|
||||||
</attributes>
|
</attributes>
|
||||||
</classpathentry>
|
</classpathentry>
|
||||||
<classpathentry kind="output" path="target/classes"/>
|
<classpathentry kind="output" path="target/classes"/>
|
||||||
|
|
13
.project
13
.project
|
@ -5,6 +5,11 @@
|
||||||
<projects>
|
<projects>
|
||||||
</projects>
|
</projects>
|
||||||
<buildSpec>
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.common.project.facet.core.builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
<buildCommand>
|
<buildCommand>
|
||||||
<name>org.eclipse.jdt.core.javabuilder</name>
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
<arguments>
|
<arguments>
|
||||||
|
@ -15,9 +20,17 @@
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.wst.validation.validationbuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
|
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
<nature>org.eclipse.m2e.core.maven2Nature</nature>
|
||||||
|
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
|
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.1-SNAPSHOT</version>
|
<version>1.4.0-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>
|
||||||
|
|
||||||
|
|
|
@ -204,19 +204,25 @@ public class PersistenceCouchBase extends PersistenceBackend {
|
||||||
protected void closeAndClean() throws Exception {
|
protected void closeAndClean() throws Exception {
|
||||||
synchronized (Connections.connectionsMap) {
|
synchronized (Connections.connectionsMap) {
|
||||||
try {
|
try {
|
||||||
for (Map.Entry<String, Bucket> entry : Connections.connectionsMap.get(nodes).getBucketsMap().entrySet())
|
if (!Connections.connectionsMap.isEmpty()){
|
||||||
{
|
|
||||||
Boolean closed = entry.getValue().close();
|
for (Map.Entry<String, Bucket> entry : Connections.connectionsMap.get(nodes).getBucketsMap().entrySet())
|
||||||
if (!closed){
|
{
|
||||||
logger.warn("bucket not close :{}",entry.getKey());
|
Boolean closed = entry.getValue().close();
|
||||||
|
if (!closed){
|
||||||
|
logger.warn("bucket not close :{}",entry.getKey());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Boolean clusterClosed= Connections.connectionsMap.get(nodes).getCluster().disconnect();
|
||||||
|
if (!clusterClosed){
|
||||||
|
logger.warn("cluster not disconnect");
|
||||||
|
}
|
||||||
|
Connections.connectionsMap.remove(nodes);
|
||||||
|
logger.trace("PersistenceCouchBase disconnect" );
|
||||||
}
|
}
|
||||||
Boolean clusterClosed= Connections.connectionsMap.get(nodes).getCluster().disconnect();
|
else{
|
||||||
if (!clusterClosed){
|
logger.warn("cluster not open");
|
||||||
logger.warn("cluster not disconnect");
|
|
||||||
}
|
}
|
||||||
Connections.connectionsMap.remove(nodes);
|
|
||||||
logger.trace("PersistenceCouchBase disconnect" );
|
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
logger.error("closeAndClean error with close and clean", e);
|
logger.error("closeAndClean error with close and clean", e);
|
||||||
throw e;
|
throw e;
|
||||||
|
|
Reference in New Issue