[
https://issues.apache.org/jira/browse/DRILL-4504?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15193932#comment-15193932
]
ASF GitHub Bot commented on DRILL-4504:
---------------------------------------
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.
> Create an event loop for each of [user, control, data] RPC components
> ---------------------------------------------------------------------
>
> Key: DRILL-4504
> URL: https://issues.apache.org/jira/browse/DRILL-4504
> Project: Apache Drill
> Issue Type: Improvement
> Components: Execution - RPC
> Reporter: Sudheesh Katkam
> Assignee: Sudheesh Katkam
>
> + Create an event loop group for each client-server pair (data, client and
> user)
> + Allow DrillClient constructor to specify an event loop group (so user event
> loop can be used for queries from Web API calls). Deprecate old DrillClient
> constructors and create a helper class to build instances.
> Miscellaneous:
> + Move WorkEventBus from exec/rpc/control to exec/work
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)