Skip to content

Commit

Permalink
task 6
Browse files Browse the repository at this point in the history
fix code climate
  • Loading branch information
NoGe4Ek committed May 3, 2024
1 parent 7972e05 commit aae3cd6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class ReferenceServer extends HttpServer {
private static final String ACK_PARAMETER_KEY = "ack=";
private static final String FROM_PARAMETER_KEY = "from=";
private static final Logger log = LoggerFactory.getLogger(ReferenceServer.class);
private static final int commonMillisTimeout = 500;
private static final int COMMON_MILLIS_TIMEOUT = 500;
private final int totalThreads = Runtime.getRuntime().availableProcessors();

private final ExecutorService executorLocal =
Expand All @@ -63,7 +63,7 @@ public ReferenceServer(ServiceConfig config,

this.httpClient = HttpClient.newBuilder()
.executor(Executors.newFixedThreadPool(totalThreads))
.connectTimeout(Duration.ofMillis(commonMillisTimeout))
.connectTimeout(Duration.ofMillis(COMMON_MILLIS_TIMEOUT))
.version(HttpClient.Version.HTTP_1_1)
.build();
}
Expand Down Expand Up @@ -223,7 +223,7 @@ private CompletableFuture<HandleResult> invokeRemote(String executorNode, Reques
: HttpRequest.BodyPublishers.ofByteArray(request.getBody())
)
.header(HEADER_REMOTE, HEADER_REMOTE_VALUE)
.timeout(Duration.ofMillis(commonMillisTimeout))
.timeout(Duration.ofMillis(COMMON_MILLIS_TIMEOUT))
.build();

return httpClient.sendAsync(httpRequest, HttpResponse.BodyHandlers.ofByteArray())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
import java.util.Map;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;

Expand Down

0 comments on commit aae3cd6

Please sign in to comment.