SteNicholas commented on code in PR #2120:
URL:
https://github.com/apache/incubator-celeborn/pull/2120#discussion_r1407731524
##########
common/src/main/java/org/apache/celeborn/common/network/client/TransportClientFactory.java:
##########
@@ -250,8 +258,29 @@ 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("Connection to {} successful, running bootstraps...",
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 bootstrapTimeMs = Duration.ofNanos(System.nanoTime() -
preBootstrap).toMillis();
+ logger.error("Exception while bootstrapping client after " +
bootstrapTimeMs + " ms", e);
+ client.close();
+ throw Throwables.propagate(e);
+ }
+ long postBootstrap = System.nanoTime();
+ logger.info(
+ "Successfully created connection to {} after {} ms ({} ms spent in
bootstraps)",
+ address,
+ Duration.ofNanos(postBootstrap - preConnect).toMillis(),
+ Duration.ofNanos(postBootstrap - preBootstrap).toMillis());
Review Comment:
```suggestion
Utils.nanoDurationToString(postBootstrap - preBootstrap));
```
--
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]