Github user galen-pivotal commented on a diff in the pull request:

    https://github.com/apache/geode/pull/716#discussion_r134026218
  
    --- Diff: 
geode-core/src/main/java/org/apache/geode/internal/cache/tier/sockets/TcpServerFactory.java
 ---
    @@ -0,0 +1,39 @@
    +package org.apache.geode.internal.cache.tier.sockets;
    +
    +import java.net.InetAddress;
    +import java.util.Properties;
    +
    +import org.apache.geode.distributed.internal.DistributionConfigImpl;
    +import org.apache.geode.distributed.internal.InternalLocator;
    +import org.apache.geode.distributed.internal.PoolStatHelper;
    +import org.apache.geode.distributed.internal.tcpserver.TcpHandler;
    +import org.apache.geode.distributed.internal.tcpserver.TcpServer;
    +
    +public class TcpServerFactory {
    +  private ClientProtocolMessageHandler protocolHandler;
    +
    +  public TcpServerFactory() {
    +    initializeMessageHandler();
    +  }
    +
    +  public TcpServer makeTcpServer(int port, InetAddress bind_address, 
Properties sslConfig,
    +      DistributionConfigImpl cfg, TcpHandler handler, PoolStatHelper 
poolHelper,
    +      ThreadGroup threadGroup, String threadName, InternalLocator 
internalLocator) {
    +
    +    return new TcpServer(port, bind_address, sslConfig, cfg, handler, 
poolHelper, threadGroup,
    +        threadName, internalLocator, protocolHandler);
    +  }
    +
    +  public synchronized ClientProtocolMessageHandler 
initializeMessageHandler() {
    +    if (!Boolean.getBoolean("geode.feature-protobuf-protocol")) {
    +      return null;
    --- End diff --
    
    Ah, I see. `TcpServer` gates on the feature flag in the one place where 
it's used. And we create the same class regardless of old or new protocol 
version. 
    
    Could the factory determine whether the new protocol is enabled and make a 
`TcpServer` that either has the new protocol enabled or not? This way we're 
only checking config in one place.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to