Skip to content

Commit 9322a61

Browse files
author
mpv1989
committed
issue #156: ArangoDB.shutdown() now closes all connections
1 parent 757fe99 commit 9322a61

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ v4.2.5 (2017-xx-xx)
44
* added ArangoDatabase.exists()
55
* issue #152: added BaseDocument.setId(String)
66
* added GraphCreateOptions.replicationFactor(Integer)
7+
* issue #156: ArangoDB.shutdown() now closes all connections
78

89
v4.2.4 (2017-09-04)
910
---------------------------

src/main/java/com/arangodb/ArangoDB.java

+9-3
Original file line numberDiff line numberDiff line change
@@ -362,12 +362,13 @@ public synchronized ArangoDB build() {
362362
}
363363

364364
private ArangoCursorInitializer cursorInitializer;
365+
private CommunicationProtocol cp;
365366

366367
public ArangoDB(final VstCommunicationSync.Builder vstBuilder, final HttpCommunication.Builder httpBuilder,
367368
final ArangoSerialization util, final CollectionCache collectionCache, final Protocol protocol) {
368369
super(new ArangoExecutorSync(createProtocol(vstBuilder, httpBuilder, util, collectionCache, protocol), util,
369370
new DocumentCache()), util);
370-
final CommunicationProtocol cp = createProtocol(vstBuilder, httpBuilder, util, collectionCache, protocol);
371+
cp = createProtocol(vstBuilder, httpBuilder, util, collectionCache, protocol);
371372
collectionCache.init(new DBAccess() {
372373
@Override
373374
public ArangoDatabase db(final String name) {
@@ -405,8 +406,13 @@ protected ArangoExecutorSync executor() {
405406
return executor;
406407
}
407408

408-
public void shutdown() {
409-
executor.disconnect();
409+
public void shutdown() throws ArangoDBException {
410+
try {
411+
executor.disconnect();
412+
cp.close();
413+
} catch (final IOException e) {
414+
throw new ArangoDBException(e);
415+
}
410416
}
411417

412418
/**

0 commit comments

Comments
 (0)