Skip to content

Commit 3c08f8e

Browse files
committed
Fixes to get past code formatting issues
patch by Bret McGuire; reviewed by Bret McGuire for PR 1928
1 parent c8b17ac commit 3c08f8e

File tree

2 files changed

+31
-27
lines changed

2 files changed

+31
-27
lines changed

core/src/main/java/com/datastax/oss/driver/internal/core/metadata/MetadataManager.java

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -439,29 +439,29 @@ private void startSchemaRequest(CompletableFuture<RefreshSchemaResult> refreshFu
439439
} else {
440440
try {
441441
schemaQueriesFactory
442-
.newInstance()
443-
.execute()
444-
.thenApplyAsync(this::parseAndApplySchemaRows, adminExecutor)
445-
.whenComplete(
446-
(newMetadata, metadataError) -> {
447-
if (metadataError != null) {
448-
refreshFuture.completeExceptionally(metadataError);
449-
} else {
450-
refreshFuture.complete(
451-
new RefreshSchemaResult(newMetadata, schemaInAgreement));
452-
}
453-
454-
firstSchemaRefreshFuture.complete(null);
455-
456-
currentSchemaRefresh = null;
457-
// If another refresh was enqueued during this one, run it now
458-
if (queuedSchemaRefresh != null) {
459-
CompletableFuture<RefreshSchemaResult> tmp =
460-
this.queuedSchemaRefresh;
461-
this.queuedSchemaRefresh = null;
462-
startSchemaRequest(tmp);
463-
}
464-
});
442+
.newInstance()
443+
.execute()
444+
.thenApplyAsync(this::parseAndApplySchemaRows, adminExecutor)
445+
.whenComplete(
446+
(newMetadata, metadataError) -> {
447+
if (metadataError != null) {
448+
refreshFuture.completeExceptionally(metadataError);
449+
} else {
450+
refreshFuture.complete(
451+
new RefreshSchemaResult(newMetadata, schemaInAgreement));
452+
}
453+
454+
firstSchemaRefreshFuture.complete(null);
455+
456+
currentSchemaRefresh = null;
457+
// If another refresh was enqueued during this one, run it now
458+
if (queuedSchemaRefresh != null) {
459+
CompletableFuture<RefreshSchemaResult> tmp =
460+
this.queuedSchemaRefresh;
461+
this.queuedSchemaRefresh = null;
462+
startSchemaRequest(tmp);
463+
}
464+
});
465465
} catch (Throwable t) {
466466
LOG.debug("[{}] Exception getting new metadata", logPrefix, t);
467467
refreshFuture.completeExceptionally(t);

core/src/test/java/com/datastax/oss/driver/internal/core/metadata/MetadataManagerTest.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,14 +295,18 @@ public void refreshSchema_should_work() {
295295
// Given
296296
IllegalStateException expectedException = new IllegalStateException("Error we're testing");
297297
when(schemaQueriesFactory.newInstance()).thenThrow(expectedException);
298-
when(topologyMonitor.refreshNodeList()).thenReturn(CompletableFuture.completedFuture(ImmutableList.of(mock(NodeInfo.class))));
299-
when(topologyMonitor.checkSchemaAgreement()).thenReturn(CompletableFuture.completedFuture(Boolean.TRUE));
300-
when(controlConnection.init(anyBoolean(), anyBoolean(), anyBoolean())).thenReturn(CompletableFuture.completedFuture(null));
298+
when(topologyMonitor.refreshNodeList())
299+
.thenReturn(CompletableFuture.completedFuture(ImmutableList.of(mock(NodeInfo.class))));
300+
when(topologyMonitor.checkSchemaAgreement())
301+
.thenReturn(CompletableFuture.completedFuture(Boolean.TRUE));
302+
when(controlConnection.init(anyBoolean(), anyBoolean(), anyBoolean()))
303+
.thenReturn(CompletableFuture.completedFuture(null));
301304
metadataManager.refreshNodes(); // required internal state setup for this
302305
waitForPendingAdminTasks(() -> metadataManager.refreshes.size() == 1); // sanity check
303306

304307
// When
305-
CompletionStage<MetadataManager.RefreshSchemaResult> result = metadataManager.refreshSchema("foo", true, true);
308+
CompletionStage<MetadataManager.RefreshSchemaResult> result =
309+
metadataManager.refreshSchema("foo", true, true);
306310

307311
// Then
308312
waitForPendingAdminTasks(() -> result.toCompletableFuture().isDone());

0 commit comments

Comments
 (0)