Jaybit0 commented on code in PR #1867:
URL: https://github.com/apache/systemds/pull/1867#discussion_r1271301785


##########
src/main/java/org/apache/sysds/runtime/controlprogram/federated/FederatedData.java:
##########
@@ -238,12 +233,18 @@ private static ChannelInitializer<SocketChannel> 
createChannel(InetSocketAddress
                        @Override
                        protected void initChannel(SocketChannel ch) throws 
Exception {
                                final ChannelPipeline cp = ch.pipeline();
+                               final 
Optional<ImmutablePair<ChannelInboundHandlerAdapter, 
ChannelOutboundHandlerAdapter>> compressionStrategy = 
FederationUtils.compressionStrategy();
                                cp.addLast("NetworkTrafficCounter", new 
NetworkTrafficCounter(FederatedStatistics::logServerTraffic));
                                if(ssl)
                                        cp.addLast(createSSLHandler(ch, 
address));
                                if(timeout > -1)
                                        cp.addLast(new 
ReadTimeoutHandler(timeout));
-                               cp.addLast(FederationUtils.decoder(), new 
FederatedRequestEncoder(), handler);
+                               // cp.addLast(FederationUtils.decoder(), new 
FederatedRequestEncoder(), handler);
+                               compressionStrategy.ifPresent(strategy -> 
cp.addLast(strategy.left));
+                               cp.addLast(FederationUtils.decoder());
+                               compressionStrategy.ifPresent(strategy -> 
cp.addLast(strategy.right));
+                               cp.addLast(new FederatedRequestEncoder());

Review Comment:
   Exactly, the consumer to add the decoder / encoder will only be executed if 
the optional value is not empty (see [java 
docs](https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html#ifPresent-java.util.function.Consumer-))



-- 
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: dev-unsubscr...@systemds.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to