Skip to content

Commit

Permalink
fix: shutdown gRPC channels when close is called (#104)
Browse files Browse the repository at this point in the history
* shutdown and wait for channel termination for both ScsDataGrpcStubsManager and ScsContorlGrpcStubsManager

* remove awaitTermination since it did not affect the exception throw once data channel was closed

* remove unused imports

* use try-with-resource to close instead of finally clause

* fix formatting
  • Loading branch information
poppoerika authored Jan 19, 2022
1 parent 89383db commit a5dae67
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
5 changes: 2 additions & 3 deletions momento-sdk/src/intTest/java/momento/sdk/BaseTestClass.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,8 @@ static void beforeAll() {
}

private static void ensureTestCacheExists() {
SimpleCacheClient client =
SimpleCacheClient.builder(System.getenv("TEST_AUTH_TOKEN"), 10).build();
try {
try (SimpleCacheClient client =
SimpleCacheClient.builder(System.getenv("TEST_AUTH_TOKEN"), 10).build()) {
client.createCache(System.getenv("TEST_CACHE_NAME"));
} catch (CacheAlreadyExistsException e) {
// do nothing. Cache already exists.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -379,5 +379,6 @@ public CompletableFuture<CacheSetResponse> setAsync(String cacheName, String key
@Override
public void close() {
scsControlClient.close();
scsDataClient.close();
}
}

0 comments on commit a5dae67

Please sign in to comment.