SteNicholas commented on code in PR #2120:
URL:
https://github.com/apache/incubator-celeborn/pull/2120#discussion_r1408882762
##########
common/src/main/java/org/apache/celeborn/common/network/client/TransportClientFactory.java:
##########
@@ -250,10 +258,31 @@ public void initChannel(SocketChannel ch) {
}
TransportClient client = clientRef.get();
+ Channel channel = channelRef.get();
assert client != null : "Channel future completed successfully with null
client";
+ // Execute any client bootstraps synchronously before marking the Client
as successful.
+ long preBootstrap = System.nanoTime();
+ logger.debug("Running bootstraps for {} ...", address);
+ try {
+ for (TransportClientBootstrap clientBootstrap : clientBootstraps) {
+ clientBootstrap.doBootstrap(client, channel);
+ }
+ } catch (Exception e) { // catch non-RuntimeExceptions too as bootstrap
may be written in Scala
+ long bootstrapTime = System.nanoTime() - preBootstrap;
+ logger.error(
+ "Exception while bootstrapping client after {}",
+ Utils.nanoDurationToString(bootstrapTime),
+ e);
+ client.close();
Review Comment:
Use try-with-resources to avoid `client` not being closed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]