Skip to content

Commit

Permalink
remove extra throws from ClientFactory.open (#157)
Browse files Browse the repository at this point in the history
* remove extra throws from ClientFactory.open

* remove throws from ClientFactory.open
  • Loading branch information
kortemik authored May 13, 2024
1 parent a0efd9d commit 9b6bed7
Showing 1 changed file with 5 additions and 10 deletions.
15 changes: 5 additions & 10 deletions src/main/java/com/teragrep/rlp_03/client/ClientFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,8 @@ public ClientFactory(ConnectContextFactory connectContextFactory, EventLoop even
*
* @param inetSocketAddress destination {@link InetSocketAddress} to connect to.
* @return a {@link Client} {@link CompletableFuture}.
* @throws IOException if connection attempt fails.
* @throws InterruptedException if waiting for connection establishment is interrupted.
* @throws ExecutionException if connection establishment fails to complete successfully.
* @throws TimeoutException if connection establishment times out.
*/
public CompletableFuture<Client> open(InetSocketAddress inetSocketAddress)
throws IOException, InterruptedException, ExecutionException, TimeoutException {
public CompletableFuture<Client> open(InetSocketAddress inetSocketAddress) {
// this is for returning ready connection
CompletableFuture<EstablishedContext> readyContextFuture = new CompletableFuture<>();
Consumer<EstablishedContext> establishedContextConsumer = readyContextFuture::complete;
Expand All @@ -100,14 +95,14 @@ public CompletableFuture<Client> open(InetSocketAddress inetSocketAddress)
try {
connectContext = connectContextFactory
.create(inetSocketAddress, clientDelegate, establishedContextConsumer);
LOGGER.debug("registering to eventLoop <{}>", eventLoop);
eventLoop.register(connectContext);
LOGGER.debug("registered to eventLoop <{}>", eventLoop);
}
catch (IOException ioException) {
clientDelegate.close();
throw ioException;
readyContextFuture.completeExceptionally(ioException);
}
LOGGER.debug("registering to eventLoop <{}>", eventLoop);
eventLoop.register(connectContext);
LOGGER.debug("registered to eventLoop <{}>", eventLoop);

return readyContextFuture.thenApply(clientDelegate::create);
}
Expand Down

0 comments on commit 9b6bed7

Please sign in to comment.