Skip to content

Commit

Permalink
Minor code improvements
Browse files Browse the repository at this point in the history
Signed-off-by: Yannic Klem <yannic.klem@bosch.io>
  • Loading branch information
Yannic92 committed Jul 20, 2020
1 parent b0c1fd8 commit e038df3
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Expand Up @@ -14,7 +14,6 @@

import static org.eclipse.ditto.model.base.common.ConditionChecker.checkNotNull;

import java.time.Duration;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionStage;
import java.util.concurrent.ScheduledExecutorService;
Expand Down Expand Up @@ -77,7 +76,7 @@ public CompletionStage<T> get() {
return result;
}

private void completeFutureEventually(int attempt, final CompletableFuture<T> resultToComplete) {
private void completeFutureEventually(final int attempt, final CompletableFuture<T> resultToComplete) {
try {
resultToComplete.complete(retriedSupplier.get());
} catch (final RuntimeException e) {
Expand All @@ -93,7 +92,7 @@ private void completeFutureEventually(int attempt, final CompletableFuture<T> re
}
}

private int getTimeToWaitInSecondsForAttempt(int attempt) {
private int getTimeToWaitInSecondsForAttempt(final int attempt) {
final int attemptIndex = ensureIndexIntoTimeToWaitBounds(attempt - 1);
return TIME_TO_WAIT_BETWEEN_RETRIES_IN_SECONDS[attemptIndex];
}
Expand All @@ -106,7 +105,7 @@ private int getTimeToWaitInSecondsForAttempt(int attempt) {
* @param <T> The type of the expected result.
* @return The result of the supplier after it finally succeeds.
*/
static <T> RetryBuilderStep1<T> retryTo(final String nameOfAction, Supplier<T> supplierToRetry) {
static <T> RetryBuilderStep1<T> retryTo(final String nameOfAction, final Supplier<T> supplierToRetry) {
return new RetryBuilder<>(nameOfAction, supplierToRetry);
}

Expand Down
Expand Up @@ -260,7 +260,7 @@ private static boolean isForbidden(final WebSocketException exception) {
* webSocketListener} for web socket handling and incoming messages.
*
* @param ws the WebSocket instance to use for connecting.
* @return An Optional holding a websocket, in case a connection could be established, otherwise the Optional will
* @return The connected websocket.
* be empty.
* @throws NullPointerException if any argument is {@code null}.
*/
Expand Down
@@ -1,4 +1,4 @@
package org.eclipse.ditto.client.messaging.internal;/*
/*
* Copyright (c) 2020 Contributors to the Eclipse Foundation
*
* See the NOTICE file(s) distributed with this work for additional
Expand All @@ -10,7 +10,7 @@
*
* SPDX-License-Identifier: EPL-2.0
*/

package org.eclipse.ditto.client.messaging.internal;

import static org.assertj.core.api.Assertions.assertThat;

Expand Down

0 comments on commit e038df3

Please sign in to comment.