drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hnfgns <...@git.apache.org>
Subject [GitHub] drill pull request: DRILL-4504: Create an event loop for each of [...
Date Mon, 14 Mar 2016 19:11:44 GMT
Github user hnfgns commented on a diff in the pull request:

    https://github.com/apache/drill/pull/429#discussion_r56058208
  
    --- Diff: exec/java-exec/src/main/java/org/apache/drill/exec/client/DrillClient.java ---
    @@ -74,73 +74,148 @@
     /**
      * Thin wrapper around a UserClient that handles connect/close and transforms
      * String into ByteBuf.
    + *
    + * Use the builder class ({@link DrillClient.Builder}) to build objects of this class.
    + * E.g.
    + * <code>
    + *   DrillClient client = DrillClient.newBuilder()
    + *       .setConfig(...)
    + *       .setIsDirectConnection(true)
    + *       .build();
    + * </code>
      */
     public class DrillClient implements Closeable, ConnectionThrottle {
       private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(DrillClient.class);
     
       private final DrillConfig config;
    -  private UserClient client;
    -  private UserProperties props = null;
    -  private volatile ClusterCoordinator clusterCoordinator;
    -  private volatile boolean connected = false;
       private final BufferAllocator allocator;
    -  private int reconnectTimes;
    -  private int reconnectDelay;
    -  private boolean supportComplexTypes;
    -  private final boolean ownsZkConnection;
    +  private final boolean isDirectConnection;
    +  private final int reconnectTimes;
    +  private final int reconnectDelay;
    +
    +  // checks if this client owns these resources (used when closing)
       private final boolean ownsAllocator;
    -  private final boolean isDirectConnection; // true if the connection bypasses zookeeper
and connects directly to a drillbit
    +  private final boolean ownsZkConnection;
    +  private final boolean ownsEventLoopGroup;
    +  private final boolean ownsExecutor;
    +
    +  // if the following variables are set during construction, they are not overridden
during or after #connect call
    +  // otherwise, they are set to defaults during #connect call
       private EventLoopGroup eventLoopGroup;
       private ExecutorService executor;
    +  private boolean supportComplexTypes;
    +
    +  // the following variables are set during connection, and must not be overridden later
    +  private UserClient client;
    +  private UserProperties props;
    +  private volatile ClusterCoordinator clusterCoordinator;
    --- End diff --
    
    -0. 
    
    Why volatile here? Is DrillClient meant to be thread safe? If so, we seem to have more
work to do: #close for instance. Otherwise volatile seems totally irrelevant.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message